Upload API (v2.0)

Use the Upload API to upload files to Content Hub. Uploads are completed in three steps:

  1. Generate an upload URL that returns metadata about the upload session. Provide the following information:

    • Configuration settings to use for the upload - an entity that hosts a predefined configuration, which specifies supported file extensions, the permitted file size, the default asset lifecycle for asset creation, and so on.

    • Purpose of the newly uploaded file - create a new asset, use the uploaded file as a new master file for an existing asset, or use the file as an alternate file for an existing asset.

  2. Upload the file to the generated upload URL.

  3. Complete the upload by providing the metadata about the session that was generated in step 1.

For more information and to see examples, refer to the Upload API documentation. For details on how to upload large files, see Upload large files.

Important
The Upload API is not intended for the bulk upload of assets. High volumes of parallel uploads can impact performance. Review Performance best practices to ensure optimal performance of Content Hub.
Note
Security is applied at the upload configuration level. This means that the user upload permissions depend on the upload configuration entities that users have access to.

Authentication

To use the Upload API, you need:

  • The URL of your Content Hub server. You can get this from your Content Hub Administrator. Enter this URL in the {{server}} variable by hovering your mouse over the variable in the Try it pane and then clicking Edit.
  • An access token and the client ID. Both are sent with every request. You can create a token through the Content Hub interface or by requesting one using the API itself.
Download OpenAPI description
Overview
Languages
Servers
https://{server}/

Upload

The Upload endpoint is used to manage file uploads.

Operations

Generate an upload URL

Request

Generates a URL that can be used to upload a file based on the upload configuration provided. For security reasons, the URL is only valid for a limited time. When uploading a file, you must provide the configuration and action to be performed with the upload.

When you upload a file, it can:
- Create a new asset.
- Create a new version of an existing asset.
- Be an alternate file for an existing asset.

Uploads require an upload configuration that defines supported file extensions, the content repository to which the file is to be uploaded, and so on. Security checks validate that the user has permission to perform uploads. The upload URL is returned in the response location header.

Body

The context for the upload.

file_namestring or null

The name of the file to be uploaded.

file_sizeinteger(int64)

The size of the file to be uploaded.

upload_configurationobject(UploadConfigurationInfo)

Information about the upload configuration.

actionobject(UploadActionInfo)
curl -i -X POST \
  https://your-server/api/v2.0/upload \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json-patch+json' \
  -d '{
    "file_name": "string",
    "file_size": 0,
    "upload_configuration": {
      "name": "string",
      "parameters": {}
    },
    "action": {
      "name": "string",
      "parameters": {}
    }
  }'

Responses

The upload URl has been created successfully

Bodyapplication/json
upload_identifierstring or null

The identifier for the upload session. This is used later to complete the upload process, after the file has been uploaded.

storage_identifierstring or null

The identifier of the upload storage. This is used later to complete the upload process after the file has been uploaded.

file_identifierstring or null

This is used later to complete the upload process after the file has been uploaded.

Response
application/json
{ "upload_identifier": "string", "storage_identifier": "string", "file_identifier": "string" }

Upload a file

Request

Uploads a file in chunks or as a whole. The URL is generated by the upload URL endpoint. When uploading in chunks, the current chunk number starts at 0 and the total number of chunks must be provided as a query string parameter. Multiple chunks can be uploaded in parallel. To notify that the last chunk has been uploaded and no more are expected, a final request needs to be made with only the parameter of the chunk.

Query
keystringrequired

The file identifier.

namestringrequired

The file name.

expiresstring(date-time)required

The expiration date of the request after which the upload URL becomes invalid.

chunkinteger(int32)

When uploading in chunks, the current chunk number.

chunksinteger(int32)

When uploading in chunks, the total number of chunks.

curl -i -X POST \
  'https://your-server/api/v2.0/upload/process?chunk=0&chunks=0&expires=2019-08-24T14%3A15%3A22Z&key=string&name=string' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Responses

File successfully uploaded

Bodyapplication/json
successboolean
messagestring or null
Response
application/json
{ "success": true, "message": "string" }

Finalize the upload process for a file

Request

Finalizes the upload of a file after all chunks have been uploaded. Requires the metadata returned during the creation of the upload URL that identifies the current upload session. When finalizing the upload process, the action configured during the creation of the upload URL is performed.

Body

The context of the upload returned when creating the upload URL.

upload_identifierstring or null

The identifier of the upload session returned during the request for the upload URL.

storage_identifierstring or null

The identifier of the upload storage returned during the request for the upload URL.

file_identifierstring or null

The file identifier returned during the request for the upload URL.

curl -i -X POST \
  https://your-server/api/v2.0/upload/finalize \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json-patch+json' \
  -d '{
    "upload_identifier": "string",
    "storage_identifier": "string",
    "file_identifier": "string"
  }'

Responses

Upload finalized successfully

Response
No content