disguise developers

Request Upload

The /request-upload endpoint of the Disguise Cloud Drive API is used to request an upload URL for a new asset or asset version. This URL can then be used to upload the content directly to the cloud storage before creating the asset or version.

Endpoints

GET
drive-api.disguise.cloud
/v1/drives/{{drive_id}}/content/{{content_id}}/request-upload
Request an upload URL to upload either a new asset or asset version.

How to Upload

Uploading assets or asset versions are a multi step process:

Before you start, you will need:

  1. drive_id: The drive_id of the drive you want to upload to (obtained from the Drives endpoint).

  2. content_id: The content_id of the parent folder you want to upload into (obtained from the Content endpoint or the Folders Endpoint). This must be a folder in order to request an upload URL.

  3. Required only when creating an asset version:
  4. content_id: The content_id of the asset you want to add the version to. When requesting an upload URL, you will use the parent folder’s content_id, but when creating the version, you will instead use the content_id of the asset you are adding a version to.

  1. First gather your drive_id and the parent folder’s content_id to determine where you would like to upload the asset to as per the above requirements.

  2. Make a GET request to the /request-upload endpoint with the drive_id and content_id in the URL. This will return an upload UUID and a URL to upload the asset to.

  3. Upload the asset to the URL using a PUT request. The asset must be uploaded in a single request, and the payload must be binary data.

  4. Once uploaded, make a POST request to either the Create Asset or Create Version endpoint using the ‘upload_uuid’ returned from the /request-upload endpoint along with the drive_id and content_id of the parent folder (or the content_id of asset if you are creating a new version).

Response Structure

The responses from the /request-upload endpoint include the following fields:

FieldTypeDescription
keystringThe key for the temporary upload location.
urlstringThe URL to upload the asset to, via a PUT request.
upload_uuidstringThe unique identifier for the upload.

Response Example

curl -X GET https://drive-api.disguise.cloud/v1/drives/{{drive_id}}/content/{{content_id}}/request-upload \
-H "Authorization: Token YOUR_API_TOKEN"

Success

A successful response will return a 200 OK status code and the following JSON:

{
  "key": "tmp/aeab5a21-5873-4014-9d3f-7c6f0479ba6e",
  "url": "https://{{signed_upload_url}}",
  "upload_uuid": "aeab5a21-5873-4014-9d3f-7c6f0479ba6e"
}

Errors

If the drive is not found, the API will return a 404 Not Found status code and the following JSON:

{
  "error": {
    "message": "Drive not found",
    "details": "Drive not found"
  }
}

If the content is not found, the API will return a 404 Not Found status code and the following JSON:

{
  "error": {
    "message": "Content not found",
    "details": "Content not found"
  }
}