This endpoint provides a method to upload media files, which may then be referenced in other API endpoints. To add a media file:

  1. Call this endpoint, passing a unique file_id chosen by the client.
  2. The response will include an upload_url. Upload the media file to that URL using a standard HTTP PUT request.
  3. Reference the uploaded file by ID in other API endpoints (e.g. Transaction Create endpoint).

Behavior

  • For an unknown media file, responds with an URL for the client to upload to (upload_url).
  • For an existing media file, responds with the content type and size, as well as the upload URL (for the client to resume incomplete uploads).
  • For an media file that’s part of a completed Transaction, not upload URL is returned.
  • Media files are referenced in other API endpoints (e.g. the Transaction Create endpoint) by file ID.

Examples

$ curl -i \
  -H 'Accept: application/json; version=1' \
  -H "Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjQyLCJpYXQiOjE0NjM2OTQ4MjN9.k48v-R-un93KdIXqp9Zi12JOGJCu8uibtrWjscFCTqc" \
  https://api.record360.com/api/users/uploads/new_file_42

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=0, private, must-revalidate

{
  "id": "new_file_42",
  "upload_url": "https://r360-uploads.s3.amazonaws.com/users/42/new_file_42?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIL3TVJJCFDZ7H5SA%2F20160628%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160628T212443Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=cb91ba9307cbad975cc08495bce3d9113402948f1b67703ff20c58bb58bb090d"
}
$ curl -i \
  -H 'Accept: application/json; version=1' \
  -H "Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjQyLCJpYXQiOjE0NjM2OTQ4MjN9.k48v-R-un93KdIXqp9Zi12JOGJCu8uibtrWjscFCTqc" \
  https://api.record360.com/api/users/uploads/existing_file_77

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=0, private, must-revalidate

{
  "id": "existing_file_77",
  "upload_url": "https://r360-uploads.s3.amazonaws.com/users/42/existing_file_77?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIL3TVJJCFDZ7H5SA%2F20160628%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160628T212443Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=cb91ba9307cbad975cc08495bce3d9113402948f1b67703ff20c58bb58bb090d",
  "type": "image/png",
  "size": 42678
}

Params

Param name Description
file_id
required

File ID, must be unique to the user

Validations:

  • Must be a String