Skip to content

Developers

How can we help you?

← Go back

Brand

A brand is the higher level entity in the hierarchy of the BeBanjo’s Catalogue. 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>Action,Drama</tags>
  <acl-hash>&lt;view@everyone&gt; &lt;edit@team#141&gt; &lt;contribute@user#38&gt;</acl-hash>
  <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="titles" href="https://movida.bebanjo.net/api/brands/123/titles"/>
  <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"/>
  <link rel="clips" href="https://movida.bebanjo.net/api/brands/123/clips"/>
  <link rel="note" href="https://movida.bebanjo.net/api/brands/123/note"/>
  <link rel="creator" href="https://movida.bebanjo.net/api/users/38"/>
</brand>
{
  "resource_type": "brand",
  "id": 123,
  "name": "The Wire",
  "external_id": "TW",
  "tags": "Action,Drama",
  "acl_hash": "<view@everyone> <edit@team#141> <contribute@user#38>",
  "self_link": "https://movida.bebanjo.net/api/brands/123",
  "series_link": "https://movida.bebanjo.net/api/brands/123/series",
  "titles_link": "https://movida.bebanjo.net/api/brands/123/titles",
  "metadata_link": "https://movida.bebanjo.net/api/brands/123/metadata",
  "images_link": "https://movida.bebanjo.net/api/brands/123/images",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/352",
  "clips_link": "https://movida.bebanjo.net/api/brands/123/clips",
  "note_link": "https://movida.bebanjo.net/api/brands/123/note",
  "creator_link": "https://movida.bebanjo.net/api/users/38"
}

The creator link represents the user creator of the brand, and it will be present only when the brand is created by a regular user, and not by an API user. This link is visible only for BeBanjo accounts configured for User Permissions.

Valid attributes

  • id (required): BeBanjo internal identifier of the brand. It shouldn’t be provided in the creation of the resource, because BeBanjo 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.

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

  • acl-hash (optional): a string representation of user permissions assigned to the brand. This property can be updated only by API users, adding or removing permissions from the list as needed.

    • Pattern: <permissionName@subjectType#subjectId>
    • Example: <contribute@team#101> <edit@everyone> <view@user#123>

    Each user permission representation const of 3 parts:

    • permissionName: the name of the Permission resource.
    • subjectType: the type of the subject being granted with permissions. Allowed values: “user” for User, “team” for Team and “everyone” when it makes reference to all users of the BeBnanjo account.
    • subjectId: the BeBanjo internal identifier of the subject.

    This attribute is only present for BeBanjo accounts configured for User Permissions.

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>
{
  // ...
  "brands_link": "https://movida.bebanjo.net/api/brands",
  // ...
}

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
$ curl --digest -u robot_user:password -H "Accept: application/json" 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>Action,Drama</tags>
    <acl-hash>&lt;view@everyone&gt; &lt;edit@team#141&gt; &lt;contribute@user#38&gt;</acl-hash>
    <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="titles" href="https://movida.bebanjo.net/api/brands/123/titles"/>
    <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"/>
    <link rel="clips" href="https://movida.bebanjo.net/api/brands/123/clips"/>
    <link rel="note" href="https://movida.bebanjo.net/api/brands/123/note"/>
    <link rel="creator" href="https://movida.bebanjo.net/api/users/38"/>
  </brand>
  <brand>
    <id type="integer">124</id>
    <name>Mad Men</name>
    <external-id>MM</external-id>
    <tags>Action,Drama</tags>
    <acl-hash>&lt;view@everyone&gt; &lt;edit@team#141&gt; &lt;contribute@user#43&gt;</acl-hash>
    <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="titles" href="https://movida.bebanjo.net/api/brands/124/titles"/>
    <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"/>
    <link rel="clips" href="https://movida.bebanjo.net/api/brands/124/clips"/>
    <link rel="note" href="https://movida.bebanjo.net/api/brands/124/note"/>
    <link rel="creator" href="https://movida.bebanjo.net/api/users/43"/>
  </brand>
  <!-- ... -->
<brands>
{
  "total_entries": 2120,
  "prev_link": "https://movida.bebanjo.net/api/brands?page=1",
  "next_link": "https://movida.bebanjo.net/api/brands?page=3",
  "entries": [
    {
      "resource_type": "brand",
      "id": 123,
      "name": "The Wire",
      "external_id": "TW",
      "tags": "Action,Drama",
      "acl_hash": "<view@everyone> <edit@team#141> <contribute@user#38>",
      "self_link": "https://movida.bebanjo.net/api/brands/123",
      "series_link": "https://movida.bebanjo.net/api/brands/123/series",
      "titles_link": "https://movida.bebanjo.net/api/brands/123/titles",
      "metadata_link": "https://movida.bebanjo.net/api/brands/123/metadata",
      "images_link": "https://movida.bebanjo.net/api/brands/123/images",
      "licensor_link": "https://movida.bebanjo.net/api/licensors/352",
      "clips_link": "https://movida.bebanjo.net/api/brands/123/clips",
      "note_link": "https://movida.bebanjo.net/api/brands/123/note",
      "creator_link": "https://movida.bebanjo.net/api/users/38"
    },
    {
      "resource_type": "brand",
      "id": 124,
      "name": "Mad Men",
      "external_id": "MM",
      "tags": "Action,Drama",
      "acl_hash": "<view@everyone> <edit@team#141> <contribute@user#43>",
      "self_link": "https://movida.bebanjo.net/api/brands/124",
      "series_link": "https://movida.bebanjo.net/api/brands/124/series",
      "titles_link": "https://movida.bebanjo.net/api/brands/124/titles",
      "titles_link": "https://movida.bebanjo.net/api/brands/124/titles",
      "metadata_link": "https://movida.bebanjo.net/api/brands/124/metadata",
      "images_link": "https://movida.bebanjo.net/api/brands/124/images",
      "licensor_link": "https://movida.bebanjo.net/api/licensors/353",
      "clips_link": "https://movida.bebanjo.net/api/brands/124/clips",
      "note_link": "https://movida.bebanjo.net/api/brands/124/note",
      "creator_link": "https://movida.bebanjo.net/api/users/43"
    },
    // ...
  ]
}

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
$ curl --digest -u robot_user:password -H "Accept: application/json" 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>Action,Drama</tags>
  <acl-hash>&lt;view@everyone&gt; &lt;edit@team#141&gt; &lt;contribute@user#38&gt;</acl-hash>
  <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"/>
  <link rel="clips" href="https://movida.bebanjo.net/api/brands/123/clips"/>
  <link rel="creator" href="https://movida.bebanjo.net/api/users/38"/>
</brand>
{
  "resource_type": "brand",
  "id": 123,
  "name": "The Wire",
  "external_id": "TW",
  "tags": "Action,Drama",
  "acl_hash": "<view@everyone> <edit@team#141> <contribute@user#38>",
  "self_link": "https://movida.bebanjo.net/api/brands/123",
  "series_link": "https://movida.bebanjo.net/api/brands/123/series",
  "titles_link": "https://movida.bebanjo.net/api/brands/123/titles",
  "metadata_link": "https://movida.bebanjo.net/api/brands/123/metadata",
  "images_link": "https://movida.bebanjo.net/api/brands/123/images",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/352",
  "clips_link": "https://movida.bebanjo.net/api/brands/123/clips",
  "note_link": "https://movida.bebanjo.net/api/brands/123/note",
  "creator_link": "https://movida.bebanjo.net/api/users/38"
}

Create a new brand

To create a brand, you just need to POST the proper XML/JSON 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
$ cat payload.json
<?xml version="1.0" encoding="UTF-8"?>
<brand>
  <name>Breaking Bad</name>
  <external-id>BB</external-id>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensors/354"/>
</brand>
{
  "name": "Breaking Bad",
  "external_id": "BB",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/354"
}

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 [[BeBanjo 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"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @payload.json "https://movida.bebanjo.net/api/brands"

BeBanjo will return the full XML/JSON 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>Action,Drama</tags>
  <acl-hash nil="true"/>
  <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="titles" href="https://movida.bebanjo.net/api/brands/125/titles"/>
  <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/licensors/354"/>
  <link rel="clips" href="https://movida.bebanjo.net/api/brands/125/clips"/>
  <link rel="note" href="https://movida.bebanjo.net/api/brands/125/note"/>
  <link rel="creator" href="https://movida.bebanjo.net/api/users/38"/>
</brand>
{
  "resource_type": "brand",
  "id": 125,
  "name": "Breaking Bad",
  "external_id": "BB",
  "tags": "Action,Drama",
  "acl_hash": null,
  "self_link": "https://movida.bebanjo.net/api/brands/125",
  "series_link": "https://movida.bebanjo.net/api/brands/125/series",
  "titles_link": "https://movida.bebanjo.net/api/brands/125/titles",
  "metadata_link": "https://movida.bebanjo.net/api/brands/125/metadata",
  "images_link": "https://movida.bebanjo.net/api/brands/125/images",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/354",
  "clips_link": "https://movida.bebanjo.net/api/brands/125/clips",
  "note_link": "https://movida.bebanjo.net/api/brands/125/note",
  "creator_link": "https://movida.bebanjo.net/api/users/38"
}

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
$ cat payload.json
<?xml version="1.0" encoding="UTF-8"?>
<brand>
  <name>Breaking Good</name>
</brand>
{
  "name": "Breaking Good"
}
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @payload.xml "https://movida.bebanjo.net/api/brands/125"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d @payload.json "https://movida.bebanjo.net/api/brands/125"

BeBanjo will return the full XML/JSON of the brand just updated:

<?xml version="1.0" encoding="UTF-8"?>
<brand>
  <id type="integer">125</id>
  <name>Breaking Good</name>
  <external-id>BB</external-id>
  <tags>Action,Drama</tags>
  <acl-hash nil="true"/>
  <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="titles" href="https://movida.bebanjo.net/api/brands/125/titles"/>
  <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/licensors/354"/>
  <link rel="clips" href="https://movida.bebanjo.net/api/brands/125/clips"/>
  <link rel="note" href="https://movida.bebanjo.net/api/brands/125/note"/>
  <link rel="creator" href="https://movida.bebanjo.net/api/users/38"/>
</brand>
{
  "resource_type": "brand",
  "id": 125,
  "name": "Breaking Good",
  "external_id": "BBBB",
  "tags": "Action,Drama",
  "acl_hash": null,
  "self_link": "https://movida.bebanjo.net/api/brands/125",
  "series_link": "https://movida.bebanjo.net/api/brands/125/series",
  "titles_link": "https://movida.bebanjo.net/api/brands/125/titles",
  "metadata_link": "https://movida.bebanjo.net/api/brands/125/metadata",
  "images_link": "https://movida.bebanjo.net/api/brands/125/images",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/354",
  "clips_link": "https://movida.bebanjo.net/api/brands/125/clips",
  "note_link": "https://movida.bebanjo.net/api/brands/125/note",
  "creator_link": "https://movida.bebanjo.net/api/users/38"
}

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/125"
$ curl --digest -u robot_user:password -H "Accept: application/json" -X DELETE "https://movida.bebanjo.net/api/brands/125"

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