Uploading Content From Your Local Storage

If your content isn't stored in the cloud and is instead stored in a location that is not accessible via the internet then you can upload your content to SHIFT's S3 buckets where it can then be ingested into SHIFT. SHIFT's S3 buckets are available to our customers who need to upload content into shift but are not able to use their own cloud storage.

You will have write access to our ingest buckets. However, you will not be able to read anything or retrieve any content. All bucket content is scoped to you account so you have no access to anyones content but your own.

The following three steps describe how you can create a new file in SHIFT from a file stored locally.

1. Create an upload ticket

curl --request POST \
  --url https://api.shift.io/v3/assets/upload \
  --header 'accept: application/json' \
  --header 'content-type: */*' \
  --header 'x-key: YOUR_API_KEY' \
  --header 'x-secret: YOUR_API_SECRET'
  --data '{ "fileName": "rough-cut-01.mp4" }'

You'll receive a response like the following. It contains all we need to start the upload to SHIFT's S3 buckets.

{
    "assetUrl": "https://s3.amazonaws.com/ingest-east.mediasilo.com/26a35865-ffff-bbbb-b9af-1999d2c7835b/myfile.mov",
    "amzDate": "Mon, 19 Jan 2020 19:17:33 GMT",
    "amzAcl": "private",
    "contentType": "video/mp4",
    "authorization": "AWS AKIAIFFFICBLRC7JU6RA:bF4dV+HkF30vCct4V1/uRKjPDFo=",
    "httpMethod": "PUT"
}

assetUrl

This is the URL to be used in your subsequent POST. It must remain unchanged.

amzDate

The date of the request. Must remain unchanged.

amzAcl

Always private. Files uploaded this way are not publicly accessible. Requesting the file after upload will result in a 403 error. Only MediaSilo servers can access the uploaded file.

contentType

The file's content mime type which was automatically determined.

authorization

This is is a one time, time limited signature that acts as an authentication string. Must remain unchanged.

httpMethod

The suggested method for file upload.

2. Upload the file to SHIFT's S3 Bucket

File upload can be done in a browser (via JavaScript) or using any number of server side languages (Java, PHP, Python, Node, etc.). The following cUrl example shows how to map the response from the upload ticket above to a well-formed file upload request to SHIFT's S3 bucket.

curl -X PUT "**assetUrl**" -H "Authorization: **authorization**" -H "x-amz-acl: **amzAcl**" -H "Content-Type: **contentType**" -H "x-amz-date: **amzDate**" -T **path/to/local/file**

🚧

Be sure that the request is accurate

If you have any trouble getting this request to work you should be sure that the response from step one matches the inputs for step 2. This is the most common mistake when uploading.

3. Creating a New File In SHIFT

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": "YOUR_SIGNED_URL_FROM_ABOVE",
    "projectId": "0XXXCC-014B-2XX0-CF518DXXXX393E"
    }'

πŸ“˜

Project ID

Notice that 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.


Did this page help you?