We use cookies (just for analytics) on this website. If you continue we will assume you are happy with it. ok

BeBanjo

Back to index

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:

<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>

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): Movida 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
<?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>

Get a List of all clips of a promotable resource

Currently in Movida 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 href="https://movida.bebanjo.net/api/titles/45606/clips" rel="clips"/>
  <!-- ... -->
</title>

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
<?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>

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 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
<content-promotion>
  <link rel="clip" href="https://movida.bebanjo.net/api/titles/10"/>
</content-promotion>
$ 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"

Movida 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>

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"

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.

Last updated September 10th, 2019.