Upload single file
0 min
{ "id" "d9e91u4qb scy21z yg5s", "type" "api oas v2", "data" { "method" "post", "url" " https //api archbee com/api/public api/upload/file https //api archbee com/api/public api/upload/file ", "servers" \[ { "url" " https //api archbee com/api/public api/upload/file https //api archbee com/api/public api/upload/file ", "description" "archbee api server" } ], "name" "upload single file", "description" "upload a single file to the file manager", "contenttype" "application/json", "request" { "pathparameters" \[], "headerparameters" \[ { "kind" "required", "name" "content type", "type" "string", "example" "multipart/form data", "description" "", "default" "multipart/form data" } ], "queryparameters" \[], "bodydataparameters" \[], "formdataparameters" \[ { "kind" "required", "name" "file", "type" "file", "example" "upload file", "description" " open api file, json or yml or yaml or zip ", "default" "@swagger json" }, { "kind" "optional", "name" "ispublic", "type" "string\<true | false>", "example" true, "description" "optional whether the uploaded file is public or not regarding aws link ", "default" true } ], "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" "upload ok status", "jsonexample" "", "isexpanded" true, "schema" \[ { "kind" "optional", "type" "object", "description" "upload ok status", "schema" \[ { "name" "status", "kind" "optional", "type" "string ", "description" "response status", "example" "ok" }, { "name" "data", "kind" "optional", "type" "object", "description" "", "example" "", "schema" \[ { "name" "src", "kind" "optional", "type" "string", "description" "aws link to the uploaded file", "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" "ydook8afu6y zufjznn k", "language" "curl", "label" "curl", "code" "curl request post \\\n url https //api archbee com/api/public api/upload/file https //api archbee com/api/public api/upload/file \\\n header 'accept application/json' \\\n header 'content type multipart/form data' \\\n form 'file="@swagger json"' \\\n form 'ispublic="true"'" }, { "id" "7qdwcslatz5mwpzquo57g", "language" "javascript", "label" "javascript", "code" "var myheaders = new headers();\nmyheaders append("accept", "application/json");\nmyheaders append("content type", "multipart/form data");\n\nvar formdata = new formdata();\nformdata append("file", "@swagger json");\nformdata append("ispublic", "true");\n\nvar requestoptions = {\n method 'post',\n headers myheaders,\n body formdata,\n redirect 'follow'\n};\n\nfetch(" https //api archbee com/api/public api/upload/file https //api archbee com/api/public api/upload/file ", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));" }, { "id" "du 8g2mdp8mcbviqginiz", "language" "ruby", "label" "ruby", "code" "require "uri"\nrequire "net/http"\n\nurl = uri(" https //api archbee com/api/public api/upload/file")\n\nhttps https //api archbee com/api/public api/upload/file")\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"] = "multipart/form data"\nform data = \[\['file', file open('undefined')],\['ispublic', file open('undefined')]]\nrequest set form form data, 'multipart/form data'\nresponse = https request(request)\nputs response read body\n" }, { "id" "ejrgtlfqc7ggnhd321e3w", "language" "python", "label" "python", "code" "import requests\n\nurl = " https //api archbee com/api/public api/upload/file"\n\npayload https //api archbee com/api/public api/upload/file"\n\npayload = {}\nfiles=\[\n\n]\nheaders = {\n 'accept' 'application/json',\n 'content type' 'multipart/form data'\n}\n\nresponse = requests request("post", url, headers=headers, data=payload, files=files)\n\nprint(response text)\n" } ], "selectedlanguageid" "ydook8afu6y zufjznn k" }, "results" { "languages" \[ { "id" "mgoaqveq5moqiiqtrtdwi", "language" "200", "code" "// upload ok status\n{\n "status" "ok",\n "data" {\n "src" ""\n }\n}" }, { "id" "7v3ediw vfa8e9rnnduvn", "language" "400", "code" "// invalid request\n{\n "status" "not ok",\n "messages" \[\n "some error message"\n ]\n}" } ], "selectedlanguageid" "mgoaqveq5moqiiqtrtdwi" } }, "children" \[ { "text" "" } ] }