Upload API

This is a step by step guide to uploading media to Big Sofa using our public api.

1. Upload URL Endoint

The first step is is to make a GET request to the Upload URL endpoint. This will provide you with a time signed Amazon S3 url to upload your media file to:

curl -X GET\
 -u {YOUR APP_ID}:{YOUR APP_SECRET}\
 "https://api.bigsofa.co.uk/v1/media/upload_url.json?mimetype={mimetype of file to be uploaded}" \
 | sed 's/\\u0026/\&/g'

This will return the following JSON:

{
  upload_url: "https://tbs-platform.s3-eu-west-1.amazonaws.com/uploads/video/video/f8e68d04-ac56-4c6d-894b-6e2ad12c2531/a6c91bac-d6df-4a65-a33f-ec4082574ef8.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIPA6DWL3X7B3CGUA%2F20160414%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20160414T130910Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&x-amz-acl=private&X-Amz-Signature=9731b9d169bb66f4b89f4be90c36073a05f32e4a655eba91638a607e70761f16",
  location: "f8e68d04-ac56-4c6d-894b-6e2ad12c2531/a6c91bac-d6df-4a65-a33f-ec4082574ef8.mp4",
}

2. Upload File

Upload your file to the Amazon url using any method you prefer:

curl -i -X PUT -T path/to/file "{upload_url}"

3. Create Media in the Big Sofa

Create a media record by posting to the Create Media endpoint. 'file_name', 'file_type' and 'file_location' are obligatory parameters. For all other optional paramters see here

// upload.json
{
  "file_name" : "{ original filename of the uploaded file }",
  "file_type" : "{ mimetype of media file }",
  "file_location" : "{ location returned in upload_url JSON }"
}
curl -X POST\
 -u {YOUR APP_ID}:{YOUR APP_SECRET}\
 --header "Content-Type: application/json"\
 -d @upload.json\
 "https://api.bigsofa.co.uk/v1/media.json"

4. Updating Media in the Big Sofa

Update a media record by posting to the Update Media endpoint. Media UID is the only required parameter, other paramters such as publish, name, description, participants and tags are optional.

// update.json
{
  "published" : "true",
}
curl -X PUT\
 -u {YOUR APP_ID}:{YOUR APP_SECRET}\
 --header "Content-Type: application/json"\
 -d @update.json\
 "https://api.bigsofa.co.uk/v1/media/{MEDIA_UID}"