File API v2

From Memsource
Jump to: navigation, search

About

The following APIs allow to upload files using various techniques. After the file is uploaded, a handle (uid) is returned and it can be used in other APIs accepting files of type exfile.

Upload File in Request Body

action: api/v2/file/uploadRequestBody
    token                       string
    name                        string

request body: binary file data

response: JSON
  {
    "uid": "1u7uhaVplPQngyAADXV1lf",
    "name": "notice.txt",
    "type": "text/plain",
    "size": 486
  }

Upload File in Multipart Form Data

action: api/v2/file/uploadMultipartFormData
    token                       string
    file                        file

response: JSON
  {
    "uid": "1u7uhaVplPQngyAADXV1lf",
    "name": "notice.txt",
    "type": "text/plain",
    "size": 486
  }

Upload File from URL

action: api/v2/file/uploadUrl
    token                       string
    url                         string
    name                        string

response: JSON
  {
    "uid": "1u7uhaVplPQngyAADXV1lf",
    "name": "notice.txt",
    "type": "text/plain",
    "size": 486
  }

Delete File

action: api/v2/file/delete
    token                       string
    uploadedFile                domain(UploadedFile)

response: empty

Download File

action: api/v2/file/download
    token                       string
    uploadedFile                domain(UploadedFile)

response: binary