media/upload

Upload a file to the server and obtain a token for the file. The token can then be used with other API methods to apply an operation with the file.

The API method accepts "multipart" uploads only.

URL

(POST) /api/media/upload?filename=&maxsize=

PARAMETERS

The URL parameters are:

filename

Optional file name. If not specified, the system uses the name specified with the multi-part upload.

Make sure to set the file extension so that the system know the type of the file.

Optional, string

maxsize

Optionally restrict the maximum size allowed for the upload. This is useful if you implement user interfaces and you want to users to upload smaller files only.

Note that the system also sets a hard size limit.

Optional, int


The file itself must be submitted with the request body as a multipart upload.

The content type of your request must be "multipart/form-data".


RESULTS

The message body contains a JSON object:

result.token

A newly created token for file.

string
result.nameThe file name.string


EXAMPLES

See this example:

{
  "result": {
      "token": "XXXXXXXXXXXX",
      "name": "myfile.docx"
   }
}


POSTMAN

In Postman choose form-data and set the field type to File. Then select a file from your PC. The binary option will not work since a "multi-part" payload is expected.




Copyright Wordbee - Buzzin' Outside the Box since 2008