Uploading Content from Your Cloud Storage

Creating a New File in Shift

Uploading your content from your cloud to Shift is simple. You just provide Shift with the URL of your file, and Shift will take care of the rest.

Calling the Asset Create endpoint will create a new file in Shift from the given URL. Here's an example:

curl --request POST \
  --url https://api.shift.io/v3/assets \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-key: YOUR_API_KEY' \
  --header 'x-secret: YOUR_API_SECRET'
  --data '{
    "sourceUrl": "URL_TO_YOUR_ASSET",
    "projectId": "0XXXCC-014B-2XX0-CF518DXXXX393E"
    }'

📘

Project ID

Notice the above request has a project ID. All of your media in Shift is organized into projects. In order to create a new file in Shift, you need to pass in the ID of the project in which you want to create the new file. Use the Projects endpoint to retrieve the projects you have access to.

Check Asset Encoding Progress

Before using the newly added asset in Shift, you will need to make sure the encoding process has completed. You can do this by calling Get Asset Encoding Progress. When the progress equals 100, that means your file is ready to be used.

curl --request POST \
  --url https://api.shift.io/v3/assets/assetUuid/encode/progress  \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-key: YOUR_API_KEY' \
  --header 'x-secret: YOUR_API_SECRET'

That's it! You've just created a new asset in Shift.

🚧

Troubleshooting

Your media may be stored securely with your cloud provider in a way that makes public access forbidden, in which case Shift won't be able to access your files. If this is the case for you, be sure to sign the URL with your cloud provider before giving the URL to Shift. Otherwise, it's likely that Shift won't be able to access the file.

How do I securely provide an asset URL to Shift?

By HMAC-signing the URLs that you provide to the Shift API, you're allowing Shift to temporarily access a file in your cloud while preventing public access to it. AWS, Google Cloud, and Azure all have support for URL signing.

AWS HMAC Signing

https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html

Google Cloud HMAC Signing

https://cloud.google.com/storage/docs/access-control/signed-urls

Azure HMAC Signing

https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview

📘

Uploading without HMAC

You don't need to sign your URLs beforehand. Shift will still ingest your files from public URLs. However, we strongly recommend that you secure your content and only provide temporary access to Shift via HMAC-signed URLs.


Did this page help you?