File upload

ENDPOINT /api/file/upload-new-file (POST only)

POST a multipart/form-data encoded request to the endpoint, with parameters:

  • file – the file upload.
    • filename – the presentation filename is taken from the filename set in this part.
    • MIME type – Set the mime type to application/octet-stream for guessing of MIME type based on the filename extension (some corrections are done on MIME types).
  • digest – SHA1 hash of the file contents, for checking upload is error free (optional)
  • file_size – size of file in bytes, for checking upload is error free (optional)
ENDPOINT /api/file/upload-new-file/with-deflate (POST only)

If the endpoint with the with_deflate suffix is used, then the file must be compressed with the zlib deflate algorithm. The hash and size are for the file before compression.

Response is:

  • response
    • status – ‘success’ if the upload succeeded
    • message * – error message
    • file_reference
      • digest – cryptographic digest of the file
      • file_size – size of file in bytes
      • filename – filename as set by the uploaded file
      • mime_type – MIME type as set by the uploaded file
      • tracking_id – a randomly generated string used to track versions of the same ‘file’ in the object history
      • log_message – user supplied log message to describe this version
      • version – user supplied version number string
      • secret – an unpredictable value which can only be generated by the server, used to prove that a client has permission to access a file

The file_reference value can be copied into an object as an attribute value.

NOTE: Check the account is sufficiently under the storage limit before uploading large numbers of files.