Developers
How can we help you?
Content promotion
The content promotion resource is used to specify the promoted content a given clip applies to.
This is how a Content promotion looks through the API:
<?xml version="1.0" encoding="UTF-8"?>
<content-promotion>
<id type="integer">1</id>
<link rel="self" href="https://movida.bebanjo.net/api/content_promotions/1"/>
<link rel="clip" href="https://movida.bebanjo.net/api/titles/5"/>
<link rel="promoted_content" href="https://movida.bebanjo.net/api/title_groups/3"/>
</content-promotion>
{
"resource_type": "content_promotion",
"id": 1,
"self_link": "https://movida.bebanjo.net/api/content_promotions/1",
"clip_link": "https://movida.bebanjo.net/api/titles/5",
"promoted_content_link": "https://movida.bebanjo.net/api/title_groups/3"
}
As you can see, a content promotion has a link to the clip
and also to the promoted_content
.
The self
link is pointing to the content promotion itself, and it is a unique URL that will not change overtime.
Valid attributes
id
(required): Mediagenix On-Demand internal identifier of the content promotion.
Get a single content promotion given its URL
The self
link of a content promotion contains a URL that will allow us to fetch that individual content promotion:
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/content_promotions/4
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/content_promotions/4
<?xml version="1.0" encoding="UTF-8"?>
<content-promotion>
<id type="integer">4</id>
<link rel="self" href="https://movida.bebanjo.net/api/content_promotions/4"/>
<link rel="clip" href="https://movida.bebanjo.net/api/titles/8"/>
<link rel="promoted_content" href="https://movida.bebanjo.net/api/brands/1"/>
</content-promotion>
{
"resource_type": "content_promotion",
"id": 4,
"self_link": "https://movida.bebanjo.net/api/content_promotions/4",
"clip_link": "https://movida.bebanjo.net/api/titles/8",
"promoted_content_link": "https://movida.bebanjo.net/api/brands/1"
}
Get a List of all clips of a promotable resource
Currently in Mediagenix On-Demand there are three types of promotable resources: Title, Title group and Brand.
Clips are accessed from a promotable resource via content promotions.
As an example, inside a Title, one of the related link nodes is the clips node, identified by the rel
attribute. Like here:
<?xml version='1.0' encoding='utf-8' ?>
<title>
<!-- ... -->
<link rel="clips" href="https://movida.bebanjo.net/api/titles/45606/clips"/>
<!-- ... -->
</title>
{
"resource_type": "title",
"id": 45606,
// ...
"clips_link": "https://movida.bebanjo.net/api/titles/45606/clips",
// ...
}
If we follow that link we can fetch the list of all content promotions for that title.
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/titles/45606/clips
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/titles/45606/clips
<?xml version="1.0" encoding="UTF-8"?>
<content-promotions type="array">
<content-promotion>
<id type="integer">4</id>
<link rel="self" href="https://movida.bebanjo.net/api/content_promotions/4"/>
<link rel="clip" href="https://movida.bebanjo.net/api/titles/8"/>
<link rel="promoted_content" href="https://movida.bebanjo.net/api/titles/45606"/>
</content-promotion>
<content-promotion>
<id type="integer">5</id>
<link rel="self" href="https://movida.bebanjo.net/api/content_promotions/5"/>
<link rel="clip" href="https://movida.bebanjo.net/api/titles/12"/>
<link rel="promoted_content" href="https://movida.bebanjo.net/api/titles/45606"/>
</content-promotion>
</content-promotions>
{
"entries": [
{
"resource_type": "content_promotion",
"id": 4,
"self_link": "https://movida.bebanjo.net/api/content_promotions/4",
"clip_link": "https://movida.bebanjo.net/api/titles/8",
"promoted_content_link": "https://movida.bebanjo.net/api/titles/45606"
},
{
"resource_type": "content_promotion",
"id": 5,
"self_link": "https://movida.bebanjo.net/api/content_promotions/5",
"clip_link": "https://movida.bebanjo.net/api/titles/12",
"promoted_content_link": "https://movida.bebanjo.net/api/titles/45606"
}
]
}
The clips associated to this title are referenced in the clip node, identified by the rel
attribute.
Adding a clip to a promotable resource
To add a clip, you just need to POST
a proper XML/JSON content promotion representation (similar to the ones you get when fetching the clips for a promotable resource) to the clips URL resource of a promotable resource. That URL can be found in a link which rel
attribute equals ‘clips’. The only required attribute is the promoted_content
.
For example, this POST
would add a clip to an episode (we’ll use curl’s @
option, which reads data to be posted from a file):
$ cat content-promotion.xml
$ cat content_promotion.json
<content-promotion>
<link rel="clip" href="https://movida.bebanjo.net/api/titles/10"/>
</content-promotion>
{
"resource_type": "content_promotion",
"clip_link": "https://movida.bebanjo.net/api/titles/10"
}
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @content-promotion.xml "https://movida.bebanjo.net/api/titles/3/clips"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @content_promotion.json "https://movida.bebanjo.net/api/titles/3/clips"
Mediagenix On-Demand will return the full XML of the content promotion just created:
<?xml version="1.0" encoding="UTF-8"?>
<content-promotion>
<id>10</id>
<link rel="self" href="https://movida.bebanjo.net/api/content_promotions/10"/>
<link rel="clip" href="https://movida.bebanjo.net/api/titles/10"/>
<link rel="promoted_content" href="https://movida.bebanjo.net/api/titles/3"/>
</content-promotion>
{
"resource_type": "content_promotion",
"id": 10,
"self_link": "https://movida.bebanjo.net/api/content_promotions/10",
"clip_link": "https://movida.bebanjo.net/api/titles/10",
"promoted_content_link": "https://movida.bebanjo.net/api/titles/3"
}
Deleting a content promotion
The following example shows how to destroy a particular content promotion. Only a DELETE
HTTP request to its URL is required:
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X DELETE "https://movida.bebanjo.net/api/content_promotions/10"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X DELETE "https://movida.bebanjo.net/api/content_promotions/10"
The DELETE
request doesn’t return anything, as that content promotion is now gone.
Deleting a content promotion doesn’t delete the clip or the promoted content associated.