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.
Uploading assets or asset versions are a multi step process:
Before you start, you will need:
drive_id: The drive_id
of the drive you want
to upload to (obtained from the
Drives endpoint).
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.
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.
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.
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.
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.
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).
The responses from the /request-upload
endpoint include the following fields:
Field | Type | Description |
---|---|---|
key | string | The key for the temporary upload location. |
url | string | The URL to upload the asset to, via a PUT request. |
upload_uuid | string | The unique identifier for the upload. |
curl -X GET https://drive-api.disguise.cloud/v1/drives/{{drive_id}}/content/{{content_id}}/request-upload \
-H "Authorization: Token YOUR_API_TOKEN"
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"
}
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"
}
}