Upload assets to library or task
Learn how to upload assets to Optimizely CMP with pre-signed URLs, multipart uploads, and seamless library integration.
Upload assets (images, videos, and raw files) to the library or a task in Optimizely Content Marketing Platform (CMP).
-
Fetch the pre-signed upload URL and its related meta-fields using the
GET /v3/upload-urlendpoint. The validity time for this URL is 60 minutes. -
Upload the file and related meta fields through an HTTP POST request to the pre-signed upload URL.
- The payload must be in
multipart/form-data. - The field name for the file must be
file. - Ensure that the meta fields are in the same order as received.
- The
filefield must be appended at the end.
If this URL is accessed multiple times with the same meta-fields, the asset is created by the last successfully uploaded file in the next step.
- The payload must be in
-
Upon success (204 HTTP response code) from the pre-signed URL, access the POST endpoint for the desired destination (library or task) by passing the
keythat was previously obtained from theGET /v3/upload-urlendpoint and an arbitrarytitleas the request payload. If this endpoint is accessed multiple times with the samekey, each access creates an asset for the same uploaded file.
You can also upload large files faster using CMP's multipart upload feature.
POST endpoints
POST /v3/assets– Add asset to library.POST /v3/assets/{asset_id}/versions– Add version to a library asset.POST /v3/tasks/{id}/assets– Add asset to a task.POST /v3/tasks/{task_id}/assets/{asset_id}/drafts– Add draft to a task asset.POST /v3/multipart-uploads– Create pre-signed URLs for multipart upload of large files.POST /v3/multipart-uploads/{id}/complete– Initiate completion of a multipart upload after all parts have been uploaded.
Updated 3 days ago