FileSpin returns Asset data in a standard JSON format as below for all Asset API calls. In addition, data posted to your Webhooks will also be of this format.
Asset Data JSON Format - Example
{
"id": "99d819953914402babbdeb68337ea6a3",
"status": "OK",
"name": "sample.mov",
"size": 8836363,
"checksum": "5f5f26bd7c0f62c6e02e44c73d09734e",
"provider": "local",
"storage_type": "AMAZON_S3",
"bucket": "filespin-labs",
"key": "/99d819953914402babbdeb68337ea6a3/sample.jpg",
"public": false,
"content_type": "video/quicktime",
"creator_id": 272,
"upload_time": "2015-07-02T08:12:56Z",
"update_user_id": 272,
"update_time": "2015-07-02T08:12:56Z",
"upload_source": "upload.example.com",
"data_schema_id": 1,
"metadata": {
"width": 1200,
"height": 800,
"duration": 30
},
"data": {
"foo": "bar"
},
"conversions": {
"720p-video": {
"storage_type": "s3",
"bucket": "filespin-labs",
"key": "/99d819953914402babbdeb68337ea6a3/720p-video.mp4",
"width": 1280,
"height": 720,
"duration": 30,
"size": 716000,
"public": true,
"watermarked": false
},
"hls-video": {
"storage_type": "s3",
"bucket": "filespin-labs",
"key": "/99d819953914402babbdeb68337ea6a3/hls/playlist.m3u8",
"width": 1280,
"height": 720,
"duration": 30,
"size": 716000,
"public": true,
"watermarked": false
}
},
"addons_info": {
"ON_DEMAND_IMAGE": {
"available": true
}
}
}
JSON Parameters
Key | Value | Description |
---|---|---|
id | string | Asset's unique ID, 32 character alphanumeric UUID |
status | string | OK if Asset was saved successfully, NOT_READY if file is being saved, ERROR if the asset has any errors (such as , if it is not a image or a video). ARCHIVED if the asset is archived. An archived asset will be available in read-only mode and cannot be updated. |
event | string | file-saved, file-processed or file-data-updated |
name | string | File name |
size | integer | Size of file in bytes |
checksum | string | MD5 checksum |
provider | string | The source of the file, local or one of the supported cloud providers |
storage_type | string | Always AMAZON_S3 in this release |
bucket | string | S3 Bucket name |
key | string | S3 Object key for this file |
public | boolean | true if file is publicly accessible, false otherwise |
content_type | string | MIME type |
creator_id | integer | User Id of file owner |
update_user_id | integer | User Id of user updating file derivatives or file data |
upload_time | string | ISO 8601 datetime, when the original file was uploaded |
update_time | string | ISO 8601 datetime, when the asset metadata was last updated |
upload_source | string | where the file was sourced from |
data_schema_id | integer | JSON Schema Id for the asset data |
metadata | JSON | Depending on Addons enabled, file metadata is returned. For image/video files, width , height in pixels and duration in seconds are always returned |
data | JSON | Optional user-data stored along with an asset |
conversions | JSON | Standard image/video conversions and those generated by addons |
addon_info | JSON | Indicates which addons were processed for the asset |
errors | JSON | Errors if any while processing asset. This will be like: {"original": "Original file appears to be invalid!"} . If there are warnings that do not affect processing but have been captured for an asset, they will be like: {"warning": "This may be a PNG file uploaded as JPG!"} |
The importance of Asset Status
When an asset is uploaded, the status may be returned as
NOT_READY
. Client applications must check if the status isOK
before trying to access the asset or invoke further asset processing. This can be done by waiting a few seconds for large files (1GB+) and a few hundred milliseconds for small files (less than 50 MB).