File upload API guide

The file upload API provides an endpoint to upload files directly to your OnSign content folder. Due to the nature of GraphQL uploading content in binary-form is unsupported and as such file uploads must be handled separately.

Requirements

The HTTP endpoint for uploads is:

https://api.onsign.tv/upload
Before you upload, check the following requirements are met.

  • Provide an Authorization: token header, like you would on the GraphQL endpoint.
  • The provided key must be a read-write API key to be able to upload files.
  • Make sure to add an Accept header that indicates you accept JSON as the response.
  • Your request must use the POST method and the binary content of the file must be provided in the body.

Parameters

Name Type Description
name string Required. The desired target file name, with extension. The extension must match the sniffed MIME type of the body. If a file with that name already exists on the destination, it will be overwritten.
parent ID Optional. Specifies the folder where the file should be uploaded to. If not provided the file is uploaded to the content root of the organization. The ID of existing folders can be obtained through the GraphQL API.
shasum string Optional. To guarantee integrity of the upload you can provide SHA-1 hash of the uploaded file, like this: a723a5b05bed2de8a2d8a4379bd2bcabe583259f. After the upload is finished the API will check whether the file content matches before storing it.

Example:

$ curl -X POST -H "Accept: application/json" \
  -H "Authorization: token YOUR-TOKEN" \
  --data-binary "@file.png" \
  https://api.onsign.tv/upload?name=sample.png

Sample response (JSON):

{
  "data": {
    "content": {
      "id": "OaB2",
      "name": "sample.png",
      "size": 20000
    }
  }
}
Overview