Update / Create document
0 min
{ "id" "dbznd puw8cnpnkgzasdd", "type" "api oas v2", "data" { "method" "post", "url" " https //api archbee com/api/public api/doc https //api archbee com/api/public api/doc ", "servers" \[ { "url" " https //api archbee com/api/public api/doc https //api archbee com/api/public api/doc ", "description" "archbee api server" } ], "name" "update / create document", "description" " create / update doc by docid ", "contenttype" "application/json", "request" { "pathparameters" \[], "headerparameters" \[ { "kind" "required", "name" "content type", "type" "string", "example" "application/json", "description" "" } ], "queryparameters" \[], "bodydataparameters" \[ { "kind" "required", "name" "body", "type" "object", "description" "", "schema" \[ { "name" "content", "kind" "required", "type" "string", "description" "markdown or json content used to update the document ", "example" "# this is a h1 title\nand this is a paragraph\n list item 1\n list item 2" }, { "name" "format", "kind" "optional", "type" "string\<markdown | json>", "description" "optional specify the format of the content default is markdown ", "example" "markdown" }, { "name" "title", "kind" "optional", "type" "string", "description" "optional, set the name of the document ", "example" "" }, { "name" "description", "kind" "optional", "type" "string", "description" "optional, set the description of the document ", "example" "" }, { "name" "previewimgurl", "kind" "optional", "type" "string", "description" "optional, set the preview image url of the document ", "example" "" }, { "name" "slug", "kind" "optional", "type" "string", "description" "optional, set the slug (url key) of the document ", "example" "" }, { "name" "alias", "kind" "optional", "type" "string", "description" "optional, set the url alias ", "example" "" }, { "name" "conditionalruleid", "kind" "optional", "type" "string", "description" "optional, set the conditional rule id ", "example" "" }, { "name" "sorting", "kind" "optional", "type" "string\<alphabetical | chronological>", "description" "optional specify the type of ordering for document insertion ", "example" "alphabetical" }, { "name" "hidden", "kind" "optional", "type" "boolean", "description" "optional, set document as hidden or not ", "example" "" }, { "name" "docid", "kind" "optional", "type" "string", "description" "optional, document id if present and valid, the doc will be updated ", "example" "21 character string0" }, { "name" "parentdocid", "kind" "optional", "type" "string", "description" "optional, parent document id if present and valid, the parent docid will be updated if sent empty, the document will be moved to the root of the tree \n", "example" "21 character string0" } ], "isexpanded" true } ], "formdataparameters" \[], "oauthparameters" \[ { "id" "bearerauth", "name" "bearerauth", "kind" "optional", "type" "http", "description" " requires the authorization header in the form authorization bearer {base64(docspaceid apikey)} where the token is base64 encoding of docspaceid, tilde, and apikey ", "scheme" "bearer" } ] }, "responses" \[ { "statuscode" "200", "description" "process status", "jsonexample" "", "isexpanded" true, "schema" \[ { "kind" "optional", "type" "object", "description" "process status", "schema" \[ { "name" "status", "kind" "optional", "type" "string ", "description" "response status ", "example" "" }, { "name" "data", "kind" "optional", "type" "object", "description" "", "example" "", "schema" \[ { "name" "docid", "kind" "optional", "type" "string", "description" "", "example" "" }, { "name" "newrecord", "kind" "optional", "type" "boolean", "description" "", "example" "" } ] } ], "isexpanded" true } ] }, { "statuscode" "400", "description" "invalid request", "jsonexample" "", "isexpanded" true, "schema" \[ { "kind" "optional", "type" "object", "description" "", "customtype" "response400", "schema" \[ { "name" "status", "kind" "optional", "type" "string\<ok | not ok>", "description" "response status", "example" "not ok" }, { "name" "messages", "kind" "optional", "type" "array", "description" "array of messages", "example" "\["some error message"]", "itemtype" "string", "customtype" "string\[]", "itemexample" "some error message", "itemdefault" "" } ], "modelref" "#/components/schemas/response400", "isexpanded" true } ] } ], "hasxcodesamples" false, "examples" { "languages" \[ { "id" "lrxqsanj687yxsmzfiykk", "language" "curl", "label" "curl", "code" "curl request post \\\n url https //api archbee com/api/public api/doc https //api archbee com/api/public api/doc \\\n header 'accept application/json' \\\n header 'content type application/json' \\\n data '{\n "content" "# this is a h1 title\nand this is a paragraph\n list item 1\n list item 2"\n }'" }, { "id" "i cmb6qrtcyrtszgdmxrj", "language" "javascript", "label" "javascript", "code" "var myheaders = new headers();\nmyheaders append("accept", "application/json");\nmyheaders append("content type", "application/json");\n\nvar raw = json stringify({\n "content" "# this is a h1 title\nand this is a paragraph\n list item 1\n list item 2"\n});\n\nvar requestoptions = {\n method 'post',\n headers myheaders,\n body raw,\n redirect 'follow'\n};\n\nfetch(" https //api archbee com/api/public api/doc https //api archbee com/api/public api/doc ", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));" }, { "id" "b3kuf erwm89ooskhhbhj", "language" "ruby", "label" "ruby", "code" "require "uri"\nrequire "json"\nrequire "net/http"\n\nurl = uri(" https //api archbee com/api/public api/doc")\n\nhttps https //api archbee com/api/public api/doc")\n\nhttps = net http new(url host, url port)\nhttps use ssl = true\n\nrequest = net http post new(url)\nrequest\["accept"] = "application/json"\nrequest\["content type"] = "application/json"\nrequest body = json dump({\n "content" "# this is a h1 title\nand this is a paragraph\n list item 1\n list item 2"\n})\n\nresponse = https request(request)\nputs response read body\n" }, { "id" "zbnwhkx8daes4negxlzwm", "language" "python", "label" "python", "code" "import requests\nimport json\n\nurl = " https //api archbee com/api/public api/doc"\n\npayload https //api archbee com/api/public api/doc"\n\npayload = json dumps({\n "content" "# this is a h1 title\nand this is a paragraph\n list item 1\n list item 2"\n})\nheaders = {\n 'accept' 'application/json',\n 'content type' 'application/json'\n}\n\nresponse = requests request("post", url, headers=headers, data=payload)\n\nprint(response text)\n" } ], "selectedlanguageid" "lrxqsanj687yxsmzfiykk" }, "results" { "languages" \[ { "id" "gdmkhtza1pm7h64twkajw", "language" "200", "code" "// process status\n{\n "status" "",\n "data" {\n "docid" "",\n "newrecord" false\n }\n}" }, { "id" "xjnzgfsk1tnfqy7wioyt9", "language" "400", "code" "// invalid request\n{\n "status" "not ok",\n "messages" \[\n "some error message"\n ]\n}" } ], "selectedlanguageid" "gdmkhtza1pm7h64twkajw" } }, "children" \[ { "text" "" } ] }