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
How to Upload
Uploading assets or asset versions is a multi step process:
Before you start, you will need:
drive_id: The
drive_idof the drive you want
to upload to (obtained from the
Drives endpoint).content_id: The
content_idof 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_idof the asset you
want to add the version to. When requesting an upload URL, you will use
the parent folder’scontent_id, but when creating the
version, you will instead use thecontent_idof the asset you
are adding a version to.
-
First gather your
drive_idand the parent folder’scontent_idto determine where you would like to upload the asset to as per the above requirements. -
Make a
GETrequest to the/request-uploadendpoint with thedrive_idandcontent_idin the URL. This will return an upload UUID and a URL to upload the asset to. -
Upload the asset to the URL using a
PUTrequest. The asset must be uploaded in a single request, and the payload must be binary data. -
Once uploaded, make a
POSTrequest to either the Create Asset or Create Version endpoint using the ‘upload_uuid’ returned from
the/request-uploadendpoint along with thedrive_idandcontent_idof the parent folder (or thecontent_idof the asset if you are creating a new version).
Response Structure
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. |
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"
}
}