Skip to content

Developers

How can we help you?

← Go back

Asset

Assets are each of the materials that need to be in place or that must be received in order for a job to be processed. An asset belongs to a job. It has no child resources.

Here is what its XML/JSON looks like:

<asset>
  <type-name>feature_film</type-name>
  <status>pending</status>
  <progress type="integer">80</progress>
  <link rel="self" href="https://sequence.example.com/api/work_areas/10/jobs/27188/assets/44804"/>
  <link rel="job" href="https://sequence.example.com/api/work_areas/10/jobs/27188"/>
</asset>
{
  "resource_type": "asset",
  "type_name": "feature_film",
  "status": "pending",
  "progress": 80,
  "self_link": "https://sequence.bebanjo.net/api/work_areas/10/jobs/27188/assets/44808",
  "job_link": "https://sequence.bebanjo.net/api/work_areas/10/jobs/27188"
}

Valid attributes

  • type-name (string, read/write): This is the name of the asset. It can be any string (like a material ID, for instance). Sequence will recognize these generic strings and will translate them appropriately to English or Spanish, depending what language you use when accessing the application via the browser. The system will recognize:

    • box_art
    • feature_film
    • making_of
    • metadata
    • music_cue_sheets
    • subtitles
    • trailer
    • transcript
  • status (string, read/write): This is the status of a specific asset. It can be in one of these four states:

    • pending: This is the initial state of an asset, when it has not been checked yet. An asset with this status should be considered not completed (it will appear as unchecked in the UI).

    • received: When an asset is checked (either because it has been received or because it has been generated). An asset with this status should be considered completed (it will appear as checked in the UI).

    • claimed: When an asset is running late and it is specifically requested to the content provider, the status will be claimed. This normally happens when issuing an email request through Sequence. An asset with this status should be considered not completed (it will appear as unchecked in the UI).

    • expecting_replacement: When an asset has been received and it is faulty, the operator can choose to request a new one; the status then turns to expecting_replacement. An asset with this status should be considered not completed (it will appear as unchecked in the UI).

    • sent: When an asset has been generated and its delivery has been notified, the status turns to ‘sent’. An asset with this status should be considered completed (it will appear as checked in the UI).

  • progress (integer, read/write, optional): A value from 0-100 indicating when the asset is pending, it’s progress in the way of being received. It’s optional, so if there’s no progress associated with the asset, this attribute will not be displayed in the XML/JSON.

Creating an asset

In order to add an asset to a specific job, it is necessary to issue a POST request to the assets list of a job. The URL for the request would look something like this:

https://sequence.example.com/api/work_areas/10/jobs/27188/assets

The attributes that can be used to create an asset are:

  • type-name (required)
  • status (optional)

Here is an example using curl:

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -d @asset.xml https://sequence.example.com/api/work_areas/10/jobs/27188/assets
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -d @asset.json https://sequence.example.com/api/work_areas/10/jobs/27188/assets

This line would issue a POST request to the URL specified at the end using digest authentication. It is also setting the HTTP header Content-Type: application/xml or Content-Type: application/json (required) and is sending the contents of the file asset.xml or asset.json as the body of the request. This is what the body of the POST request should look like:

<asset>
  <type-name>S12340001</type-name>
</asset>
{
  "type_name": "S12340001"
}

If successfully created, the response will be the complete XML/JSON of the new job with an HTTP status code of 200:

<asset>
  <type-name>S12340001</type-name>
  <status>pending</status>
  <link rel="self" href="https://sequence.example.com/api/work_areas/10/jobs/27188/assets/44809"/>
  <link rel="job" href="https://sequence.example.com/api/work_areas/10/jobs/27188"/>
</asset>
{
  "resource_type": "asset",
  "type_name": "S12340001",
  "status": "pending",
  "self_link": "https://sequence.bebanjo.net/api/work_areas/10/jobs/27188/assets/44809",
  "job_link": "https://sequence.bebanjo.net/api/work_areas/10/jobs/27188"
}

Updating an asset

To update an asset, it is necessary to issue a PUT request to the URL of a given asset. The body of the request should contain the XML/JSON of the asset with the changed attributes. Note that not all attributes must be included, it would be enough to include the attributes that we wish to update.

The following example updates the status of the previous asset. Note how the URL used now is the one that uniquely identifies the asset:

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @asset_update.xml https://sequence.example.com/api/work_areas/10/jobs/27188/assets/44809
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d @asset_update.json https://sequence.example.com/api/work_areas/10/jobs/27188/assets/44809

This is what the body of the request would contain:

<asset>
  <status>received</status>
</asset>
{
  "status": "received"
}

If the request is successful, it should return the updated asset XML/JSON and a status code of 200:

<asset>
  <type-name>S12340001</type-name>
  <status>received</status>
  <link rel="self" href="https://sequence.example.com/api/work_areas/10/jobs/27188/assets/44809"/>
  <link rel="job" href="https://sequence.example.com/api/work_areas/10/jobs/27188"/>
</asset>
{
  "resource_type": "asset",
  "type_name": "S12340001",
  "status": "received",
  "self_link": "https://sequence.bebanjo.net/api/work_areas/10/jobs/27188/assets/44809",
  "job_link": "https://sequence.bebanjo.net/api/work_areas/10/jobs/27188"
}

Deleting an asset

In order to DELETE an asset, it is only necessary to issue a DELETE request to the asset URL, like so:

$ curl --digest -u robot_user:password -X DELETE https://sequence.example.com/api/work_areas/10/jobs/27188/assets/44809
$ curl --digest -u robot_user:password -H "Accept: application/json" -X DELETE https://sequence.example.com/api/work_areas/10/jobs/27188/assets/44809

The response should be a 204 (no content) HTTP Status code, with no body.