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

Brand

A brand is the higher level entity in the hierarchy of the Movida’s Catalog. If a Series is generally a season, a brand is the entity that groups the Series for all the seasons of the same show. For example, a brand called “The Wire” will contain the Series “The Wire S1”, “The Wire S2”, etc…

This is how a brand looks through the API:

<brand>
  <id type="integer">123</id>
  <name>The Wire</name>
  <external-id>TW</external-id>
  <tags>Drama,Action</tags>
  <link rel="self" href="https://movida.bebanjo.net/api/brands/123"/>
  <link rel="series" href="https://movida.bebanjo.net/api/brands/123/series"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/brands/123/metadata"/>
  <link rel="images" href="https://movida.bebanjo.net/api/brands/123/images"/>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensor/352"/>
</brand>

Valid attributes

  • id (required): Movida internal identifier of the brand. It shouldn’t be provided in the creation of the resource, because Movida will assign that value.

  • external-id (optional): the identifier of the brand in the external system. If provided, it has to be unique in the scope of the company.

  • name (required): the name of the brand. This name must be unique for your company: so two brands cannot have the same name.

  • tags (optional): the list of tags separated by commas of the brand.

Get a list of all brands in the current account

brands are linked from the root of the API, through the link identified with the rel="brands" attribute:

<?xml version="1.0" encoding="UTF-8"?>
<movida>
  <!-- ... -->
  <link rel="brands" href="https://movida.bebanjo.net/api/brands">
</movida>

Following that link, we can fetch the list of brands in the current account.

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/brands
<?xml version="1.0" encoding="UTF-8"?>
<brands>
  <total-entries>2120</total-entries>
  <link rel="next" href="https://movida.bebanjo.net/api/brands?page=1"/>
  <link rel="prev" href="https://movida.bebanjo.net/api/brands?page=3"/>
  <brand>
    <id type="integer">123</id>
    <name>The Wire</name>
    <external-id>TW</external-id>
    <tags>Drama,Action</tags>
    <link rel="self" href="https://movida.bebanjo.net/api/brands/123"/>
    <link rel="series" href="https://movida.bebanjo.net/api/brands/123/series"/>
    <link rel="metadata" href="https://movida.bebanjo.net/api/brands/123/metadata"/>
    <link rel="images" href="https://movida.bebanjo.net/api/brands/123/images"/>
    <link rel="licensor" href="https://movida.bebanjo.net/api/licensor/352"/>
  </brand>
  <brand>
    <id type="integer">124</id>
    <name>Mad Men</name>
    <external-id>MM</external-id>
    <tags>Drama,Action</tags>
    <link rel="self" href="https://movida.bebanjo.net/api/brands/124"/>
    <link rel="series" href="https://movida.bebanjo.net/api/brands/124/series"/>
    <link rel="metadata" href="https://movida.bebanjo.net/api/brands/124/metadata"/>
    <link rel="images" href="https://movida.bebanjo.net/api/brands/124/images"/>
    <link rel="licensor" href="https://movida.bebanjo.net/api/licensor/353"/>
  </brand>
  <!-- ... -->
<linear-schedulings>

Note: This is a paginated resource. By default, only 50 brands will be included in each page but you can override this default by using the per_page parameter described in the next section. The total-entries attribute will indicate the total number of entries and the links rel="next" and rel="prev" should be used to get the next and the previous pages.

You can filter the list of brands returned using the following attributes:

  • external_id: It will return only the brand with the 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 single brand given its URL

The self link of a brand contains a URL that will allow us to fetch that individual brand:

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/brands/123
<?xml version="1.0" encoding="UTF-8"?>
<brand>
  <id type="integer">123</id>
  <name>The Wire</name>
  <external-id>TW</external-id>
  <tags>Drama,Action</tags>
  <link rel="self" href="https://movida.bebanjo.net/api/brands/123"/>
  <link rel="series" href="https://movida.bebanjo.net/api/brands/123/series"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/brands/123/metadata"/>
  <link rel="images" href="https://movida.bebanjo.net/api/brands/123/images"/>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensor/352"/>
</brand>

Create a new brand

To create a brand, you just need to POST the proper XML representation of a brand (similar to the ones you get when fetching) to the URL that you can find in the link rel="brands" of the root of the API.

For example, this POST would create a brand: (we’ll use curl’s @ option, which reads the data that is to be posted to the URL from a file)

$ cat payload.xml
<?xml version="1.0" encoding="UTF-8"?>
<brand>
  <id type="integer">125</id>
  <name>Breaking Bad</name>
  <external-id>BB</external-id>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensor/354"/>
</brand>

Note: The licensor URL must be of one licensor that already exists in the system, licensor URL is optional. See how to create licensors in the [[Movida Resource: Licensor]] page.

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @payload.xml "https://movida.bebanjo.net/api/brands"

Movida will return the full XML of the brand just created:

<?xml version="1.0" encoding="UTF-8"?>
<brand>
  <id type="integer">125</id>
  <name>Breaking Bad</name>
  <external-id>BB</external-id>
  <tags>Drama,Action</tags>
  <link rel="self" href="https://movida.bebanjo.net/api/brands/125"/>
  <link rel="series" href="https://movida.bebanjo.net/api/brands/125/series"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/brands/125/metadata"/>
  <link rel="images" href="https://movida.bebanjo.net/api/brands/125/images"/>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensor/354"/>
</brand>

Updating a brand

You can update an existing brand sending a PUT request to the URL of the brand (that you can get from its link rel="self"). You only need to include those attributes of the brand that you wish to update:

$ cat payload.xml
<?xml version="1.0" encoding="UTF-8"?>
<brand>
  <name>Breaking Good</name>
</brand>
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @payload.xml "https://movida.bebanjo.net/api/brands/126"

Movida will return the full XML of the brand just updated:

<?xml version="1.0" encoding="UTF-8"?>
<brand>
  <id type="integer">126</id>
  <name>Breaking Good</name>
  <external-id>BB</external-id>
  <tags>Drama,Action</tags>
  <link rel="self" href="https://movida.bebanjo.net/api/brands/125"/>
  <link rel="series" href="https://movida.bebanjo.net/api/brands/125/series"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/brands/125/metadata"/>
  <link rel="images" href="https://movida.bebanjo.net/api/brands/125/images"/>
</brand>

Deleting a brand

You can also delete a brand using a DELETE request to the brand URL:

$ curl --digest -u robot_user:password -X DELETE "https://movida.bebanjo.net/api/brands/126"

Note: Deleting a brand won’t delete its series in cascade. Those series will keep existing but they won’t belong to any brand.

Last updated July 07th, 2017.