Developers
How can we help you?
Asset
Note: This resource links can be expanded using the expand option.
The asset resource represents an Editorial Version of a given feature or episode of a series (i.e. with or without violence, with or without ads, etc.), and that Editorial Version can be then held in multiple video renditions (different bit rates, different video formats, etc..)
This is how an asset looks through the API:
<?xml version="1.0" encoding="UTF-8"?>
<asset>
<id type="integer">1</id>
<name>C5157460053A</name>
<external-id nil="true"/>
<type>EMEA UK House ID</type>
<runtime type="duration">02:13:21.000</runtime>
<description>NewOne</description>
<link rel="self" href="https://movida.bebanjo.net/api/assets/1"/>
<link rel="metadata" href="https://movida.bebanjo.net/api/assets/1/metadata"/>
<link rel="title" href="https://movida.bebanjo.net/api/titles/1"/>
<link rel="renditions" href="https://movida.bebanjo.net/api/assets/1/renditions"/>
<link rel="segments" href="https://movida.bebanjo.net/api/assets/1/segments"/>
<link rel="schedule" href="https://movida.bebanjo.net/api/assets/1/schedule"/>
</asset>
{
"resource_type": "asset",
"id": 1,
"name": "C5157460053A",
"external_id": null,
"type": "EMEA UK House ID",
"runtime": "02:13:21.000",
"description": "NewOne",
"self_link": "https://movida.bebanjo.net/api/assets/1",
"metadata_link": "https://movida.bebanjo.net/api/assets/1/metadata",
"title_link": "https://movida.bebanjo.net/api/titles/976944",
"renditions_link": "https://movida.bebanjo.net/api/assets/1/renditions",
"segments_link": "https://movida.bebanjo.net/api/assets/1/segments",
"schedule_link": "https://movida.bebanjo.net/api/assets/1/schedule"
}
Valid attributes
-
id
(required): Mediagenix On-Demand internal identifier of the asset. It mustn’t be supplied in the creation of the asset, because Mediagenix On-Demand will set this attribute. -
name
(required): the name of the asset. It has to be unique in the scope of the company. -
external-id
(optional): the identifier of the asset in the external system. If provided, it has to be unique in the scope of the company. -
type
(optional): the asset type. Please, contact your Technical Account Manager in order to define the list of asset types suitable for your company. -
description
(optional): the description of the asset. -
runtime
(optional): the runtime of the asset. Formathh:mm:ss.mmm
. The miliseconds are optional, an asset with 01:01:01 is valid, it’s assumed 0 milliseconds.
Get a list of all asset in the current account
Assets are linked from the root of the API, through the link identified with the rel="assets"
attribute:
<?xml version="1.0" encoding="UTF-8"?>
<movida>
<!-- ... -->
<link rel="assets" href="https://movida.bebanjo.net/api/assets">
<!-- ... -->
</movida>
{
// ...
"assets_link": "https://movida.bebanjo.net/api/assets",
// ...
}
Following that link, we can fetch the list of assets in the current account.
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/assets
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/assets
<?xml version="1.0" encoding="UTF-8"?>
<assets type="array">
<total-entries>2120</total-entries>
<link rel="next" href="https://movida.bebanjo.net/api/assets?page=1"/>
<link rel="prev" href="https://movida.bebanjo.net/api/assets?page=3"/>
<asset>
<id type="integer">1</id>
<name>C5157460053A</name>
<external-id nil="true"/>
<type nil="true"/>
<runtime type="duration">02:13:21.000</runtime>
<description nil="true"/>
<link rel="self" href="https://movida.bebanjo.net/api/assets/1"/>
<link rel="metadata" href="https://movida.bebanjo.net/api/assets/1/metadata"/>
<link rel="title" href="https://movida.bebanjo.net/api/titles/1"/>
<link rel="renditions" href="https://movida.bebanjo.net/api/assets/1/renditions"/>
<link rel="segments" href="https://movida.bebanjo.net/api/assets/1/segments"/>
<link rel="schedule" href="https://movida.bebanjo.net/api/assets/1/schedule"/>
</asset>
<asset>
<id type="integer">2</id>
<name>C5157460053B</name>
<external-id nil="true"/>
<type nil="true"/>
<runtime type="duration">01:16:16.000</runtime>
<description nil="true"></description>
<link rel="self" href="https://movida.bebanjo.net/api/assets/2"/>
<link rel="metadata" href="https://movida.bebanjo.net/api/assets/2/metadata"/>
<link rel="title" href="https://movida.bebanjo.net/api/titles/1"/>
<link rel="renditions" href="https://movida.bebanjo.net/api/assets/2/renditions"/>
<link rel="segments" href="https://movida.bebanjo.net/api/assets/2/segments"/>
<link rel="schedule" href="https://movida.bebanjo.net/api/assets/2/schedule"/>
</asset>
<!-- ... -->
<assets>
{
"total_entries": 2120,
"prev_link": "https://movida.bebanjo.net/api/assets?page=1",
"next_link": "https://movida.bebanjo.net/api/assets?page=3",
"entries": [
{
"resource_type": "asset",
"id": 1,
"name": "C5157460053A",
"external_id": null,
"type": null,
"runtime": "02:13:21.000",
"description": null,
"self_link": "https://movida.bebanjo.net/api/assets/1",
"metadata_link": "https://movida.bebanjo.net/api/assets/1/metadata",
"title_link": "https://movida.bebanjo.net/api/titles/1",
"renditions_link": "https://movida.bebanjo.net/api/assets/1/renditions",
"segments_link": "https://movida.bebanjo.net/api/assets/1/segments",
"schedule_link": "https://movida.bebanjo.net/api/assets/1/schedule"
},
{
"resource_type": "asset",
"id": 2,
"name": "C5157460053B",
"external_id": null,
"type": null,
"runtime": "01:16:16.000",
"description": "",
"self_link": "https://movida.bebanjo.net/api/assets/2",
"metadata_link": "https://movida.bebanjo.net/api/assets/2/metadata",
"title_link": "https://movida.bebanjo.net/api/titles/1",
"renditions_link": "https://movida.bebanjo.net/api/assets/2/renditions",
"segments_link": "https://movida.bebanjo.net/api/assets/2/segments",
"schedule_link": "https://movida.bebanjo.net/api/assets/2/schedule"
},
// ...
]
}
Note: This is a paginated resource. By default, only 50 assets will be included in each page but you can override this default by using the
per_page
parameter described in the next section. Thetotal-entries
attribute will indicate the total number of entries and the linksrel="next"
andrel="prev"
should be used to get the next and the previous pages.
You can filter the list of assets returned using the following attributes:
name
: It will return only the asset with the exact given name (if any).external-id
: It will return only the asset with the exact given external-id (if any).per_page
: Number of elements returned in each page. The maximum value allowed is 200 and the default is 50.
Get a list for all assets of a Title
Assets can be accessed via the Title they belong to, as in the example below, through the link identified by the rel="assets"
attribute:
<?xml version="1.0" encoding="UTF-8"?>
<title>
<id type="integer">30530</id>
<name>Episode 1</name>
<episode-number type="integer">1</episode-number>
<title>E01, Episode 1</title>
<external-id>C5155250234</external-id>
<title-type>episode</title-type>
<tags></tags>
<link rel="self" href="https://movida.bebanjo.net/api/titles/30530"/>
<link rel="schedule" href="https://movida.bebanjo.net/api/titles/30530/schedule"/>
<link rel="linear_schedulings" href="https://movida.bebanjo.net/api/titles/30530/linear_schedulings"/>
<link rel="availability_windows" href="https://movida.bebanjo.net/api/titles/30530/availability_windows"/>
<link rel="series" href="https://movida.bebanjo.net/api/title_groups/3571"/>
<link rel="title_groups" href="https://movida.bebanjo.net/api/titles/30530/title_groups"/>
<link rel="licensor" href="https://movida.bebanjo.net/api/licensors/69"/>
<link rel="images" href="https://movida.bebanjo.net/api/titles/30530/images"/>
<link rel="assets" href="https://movida.bebanjo.net/api/titles/30530/assets"/>
<link rel="metadata" href="https://movida.bebanjo.net/api/titles/30530/metadata"/>
<link rel="clips" href="https://movida.bebanjo.net/api/titles/30530/clips"/>
<link rel="note" href="https://movida.bebanjo.net/api/titles/30530/note"/>
</title>
{
"resource_type": "title",
"id": 30530,
"name": "Episode 1",
"episode_number": 1,
"title": "E01, Episode 1",
"external_id": "C5155250234",
"title_type": "episode",
"tags": "",
"self_link": "https://movida.bebanjo.net/api/titles/30530",
"schedule_link": "https://movida.bebanjo.net/api/titles/30530/schedule",
"linear_schedulings_link": "https://movida.bebanjo.net/api/titles/30530/linear_schedulings",
"availability_windows_link": "https://movida.bebanjo.net/api/titles/30530/availability_windows",
"series_link": "https://movida.bebanjo.net/api/title_groups/3571",
"title_groups_link": "https://movida.bebanjo.net/api/titles/30530/title_groups",
"licensor_link": "https://movida.bebanjo.net/api/licensors/69",
"images_link": "https://movida.bebanjo.net/api/titles/30530/images",
"assets_link": "https://movida.bebanjo.net/api/titles/30530/assets",
"metadata_link": "https://movida.bebanjo.net/api/titles/30530/metadata",
"clips_link": "https://movida.bebanjo.net/api/titles/30530/clips",
"note_link": "https://movida.bebanjo.net/api/titles/30530/note"
}
If we follow that link, we can fetch the list of all assets for that title.
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/titles/30530/assets
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/titles/30530/assets
<?xml version="1.0" encoding="UTF-8"?>
<assets type="array">
<asset>
<id type="integer">29583</id>
<name>C5155250234A</name>
<external-id nil="true"/>
<type>EMEA UK House ID</type>
<runtime type="duration">00:21:41.040</runtime>
<description>NewOne</description>
<link rel="self" href="https://movida.bebanjo.net/api/assets/29583"/>
<link rel="metadata" href="https://movida.bebanjo.net/api/assets/29583/metadata"/>
<link rel="title" href="https://movida.bebanjo.net/api/titles/30530"/>
<link rel="renditions" href="https://movida.bebanjo.net/api/assets/29583/renditions"/>
<link rel="segments" href="https://movida.bebanjo.net/api/assets/29583/segments"/>
<link rel="schedule" href="https://movida.bebanjo.net/api/assets/29583/schedule"/>
</asset>
</assets>
{
"entries": [
{
"resource_type": "asset",
"id": 29583,
"name": "C5155250234A",
"external_id": null,
"type": "EMEA UK House ID",
"runtime": "00:21:41.040",
"description": "NewOne",
"self_link": "https://movida.bebanjo.net/api/assets/29583",
"metadata_link": "https://movida.bebanjo.net/api/assets/29583/metadata",
"title_link": "https://movida.bebanjo.net/api/titles/976944",
"renditions_link": "https://movida.bebanjo.net/api/assets/29583/renditions",
"segments_link": "https://movida.bebanjo.net/api/assets/29583/segments",
"schedule_link": "https://movida.bebanjo.net/api/assets/29583/schedule"
}
]
}
Get a specific asset
This is a good way to recover information about a specific asset.
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/assets/29583
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/assets/29583
<?xml version="1.0" encoding="UTF-8"?>
<asset>
<id type="integer">29583</id>
<name>C5155250234A</name>
<external-id nil="true"/>
<type>EMEA UK House ID</type>
<runtime>01:34:00.000</runtime>
<description>NewOne</description>
<link rel="self" href="https://movida.bebanjo.net/api/assets/29583"/>
<link rel="metadata" href="https://movida.bebanjo.net/api/assets/29583/metadata"/>
<link rel="title" href="https://movida.bebanjo.net/api/titles/30530"/>
<link rel="renditions" href="https://movida.bebanjo.net/api/assets/29583/renditions"/>
<link rel="segments" href="https://movida.bebanjo.net/api/assets/29583/segments"/>
<link rel="schedule" href="https://movida.bebanjo.net/api/assets/29583/schedule"/>
</asset>
{
"resource_type": "asset",
"id": 29583,
"name": "C5155250234A",
"external_id": null,
"type": "EMEA UK House ID",
"runtime": "01:34:00.000",
"description": "NewOne",
"self_link": "https://movida.bebanjo.net/api/assets/29583",
"metadata_link": "https://movida.bebanjo.net/api/assets/29583/metadata",
"title_link": "https://movida.bebanjo.net/api/titles/976944",
"renditions_link": "https://movida.bebanjo.net/api/assets/29583/renditions",
"segments_link": "https://movida.bebanjo.net/api/assets/29583/segments",
"schedule_link": "https://movida.bebanjo.net/api/assets/29583/schedule"
}
Creating a new asset for a title
To create an asset, you just need to POST
a proper XML/JSON asset representation (similar to the ones you get when fetching an asset) to the proper URL. As explained above, that URL is in the link node whose ‘rel’ attribute equals ‘assets’.
For example, this POST
would create an asset (we’ll use curl’s @ option, which reads the data that is to be posted to the URL from a file):
$ cat asset.xml
$ cat asset.json
<?xml version="1.0" encoding="UTF-8"?>
<asset>
<name>C5151515151</name>
<external-id>EXT-00151</external-id>
<description></description>
<runtime>01:34:00.000</runtime>
</asset>
{
"name": "C5151515151",
"external_id": "EXT-00151",
"description": "",
"runtime": "01:34:00.000"
}
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @asset.xml "https://movida.bebanjo.net/api/titles/30530/assets"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @asset.json "https://movida.bebanjo.net/api/titles/30530/assets"
Mediagenix On-Demand will return the full XML/JSON of the asset just created:
<?xml version="1.0" encoding="UTF-8"?>
<asset>
<id type="integer">37366</id>
<name>C5151515151</name>
<external-id>EXT-00151</external-id>
<type nil="true"/>
<runtime type="duration">01:34:00.000</runtime>
<description nil="true"></description>
<link rel="self" href="https://movida.bebanjo.net/api/assets/37366"/>
<link rel="metadata" href="https://movida.bebanjo.net/api/assets/37366/metadata"/>
<link rel="title" href="https://movida.bebanjo.net/api/titles/30530"/>
<link rel="renditions" href="https://movida.bebanjo.net/api/assets/37366/renditions"/>
<link rel="segments" href="https://movida.bebanjo.net/api/assets/37366/segments"/>
<link rel="schedule" href="https://movida.bebanjo.net/api/assets/37366/schedule"/>
</asset>
{
"resource_type": "asset",
"id": 37366,
"name": "C5151515151",
"external_id": "EXT-00151",
"type": null,
"runtime": "01:34:00.000",
"description": null,
"self_link": "https://movida.bebanjo.net/api/assets/37366",
"metadata_link": "https://movida.bebanjo.net/api/assets/37366/metadata",
"title_link": "https://movida.bebanjo.net/api/titles/976944",
"renditions_link": "https://movida.bebanjo.net/api/assets/37366/renditions",
"segments_link": "https://movida.bebanjo.net/api/assets/37366/segments",
"schedule_link": "https://movida.bebanjo.net/api/assets/37366/schedule"
}
Updating an asset
As our introduction to REST APIs guide suggests, you can update an asset using a PUT
request to each asset URI. You only need to include those attributes of the asset that you wish to update:
$ cat asset_update.xml
$ cat asset_update.json
<asset>
<type>Asset Type</type>
<runtime>00:34:00.000</runtime>
<description>This is the new description</description>
</asset>
{
"type": "Asset Type",
"runtime": "00:34:00.000",
"description": "This is the new description"
}
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @asset_update.xml "https://movida.bebanjo.net/api/assets/37366"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d @asset_update.json "https://movida.bebanjo.net/api/assets/37366"
As always Mediagenix On-Demand will return the full XML/JSON of the asset just updated:
<?xml version="1.0" encoding="UTF-8"?>
<asset>
<id type="integer">37366</id>
<name>C5151515151</name>
<external-id nil="true"/>
<type>Asset Type</type>
<runtime type="duration">00:34:00.000</runtime>
<description>This is the new description</description>
<link rel="self" href="https://movida.bebanjo.net/api/assets/37366"/>
<link rel="metadata" href="https://movida.bebanjo.net/api/assets/37366/metadata"/>
<link rel="title" href="https://movida.bebanjo.net/api/titles/30530"/>
<link rel="renditions" href="https://movida.bebanjo.net/api/assets/37366/renditions"/>
<link rel="segments" href="https://movida.bebanjo.net/api/assets/37366/segments"/>
<link rel="schedule" href="https://movida.bebanjo.net/api/assets/37366/schedule"/>
</asset>
{
"resource_type": "asset",
"id": 37366,
"name": "C5151515150",
"external_id": "EXT-00150",
"type": "Asset Type",
"runtime": "00:34:00.000",
"description": "This is the new description",
"self_link": "https://movida.bebanjo.net/api/assets/37366",
"metadata_link": "https://movida.bebanjo.net/api/assets/37366/metadata",
"title_link": "https://movida.bebanjo.net/api/titles/976944",
"renditions_link": "https://movida.bebanjo.net/api/assets/37366/renditions",
"segments_link": "https://movida.bebanjo.net/api/assets/37366/segments",
"schedule_link": "https://movida.bebanjo.net/api/assets/37366/schedule"
}
Deleting an asset
You can also delete an asset using DELETE request to each asset URI:
$ curl --digest -u robot_user:password -X DELETE "https://movida.bebanjo.net/api/assets/37366"
$ curl --digest -u robot_user:password -H "Accept: application/json" -X DELETE "https://movida.bebanjo.net/api/assets/37366"
Deleting an asset will cause any associated segment, rendition, audio track and subtitle to be deleted too. Also, schedulings and linear schedulings associated to the asset will be updated and associated to no asset.