Creating an Asset: POST

To create an asset, use POST /v2/assets with properties in the body of the request.

Note: For more information about Backlot REST API commands, see the Backlot API Reference.
Note: The following steps are for the creation of general assets.
Use the POST method with the /v2/assets route and properties in the request body.
Note: In addition to creating the asset for them, video and audio files must also be uploaded; see Uploading a Video or Audio Asset: Four Steps.
Note: Properties in the body of the POST vary by asset type.
[POST]/v2/assets{  
   "asset_type":"video",
   "duration":0,
   "name":"My Video",
   "preview_image_url":null,
   "created_at":"2011-07-22T18:54:19+00:00",
   "embed_code":"Y1dTdvMjq9QtOMGrP-H59OIgiZ6-_Mrl",
   "time_restrictions":null,
   "updated_at":"2011-07-22T18:54:19+00:00",
   "external_id":null,
   "description":null,
   "status":"uploading",
}

Backlot returns a response similar to the following. Note the embed_code property. This is the key to the asset (referred to as asset_id in the documentation) and is required to update, delete, or work with the asset in general.

{  
   "asset_type":"video",
   "duration":30,
   "name":"My Video",
   "preview_image_url":null,
   "created_at":"2011-07-22T18:54:19+00:00",
   "embed_code":"Y1dTdvMjq9QtOM",
   "time_restrictions":null,
   "updated_at":"2011-07-22T20:51:07+00:00",
   "external_id":null,
   "hosted_at":"http://www.mydomain.com",
   "original_file_name":"my_video.avi"
}
Note:

Try out the code samples using your account credentials in the Ooyala Scratchpad. For information about using the Scratchpad, see Practice Making Requests with the Scratchpad. To launch the scratchpad, go to Ooyala API Scratchpad.

The asset is successfully created.

Was this article helpful?