Skip to content

Developers

How can we help you?

← Go back

Linear channel

Note: Only Mediagenix On-Demand accounts configured for Catch-Up or Planning will expose linear channels in the API.

A linear channel is a standard channel on a TV network which displays programming sequentially in a non-interactive fashion (i.e. the customer cannot decide what to see when, as opposed to in a platform). Examples of Linear Channels would be BBC 1, LaSexta or National Geographic.

This is how a Linear Channel looks through the API:

<?xml version="1.0" encoding="UTF-8"?>
<linear-channel>
  <id type="integer">3</id>
  <name>Channel 5</name>
  <external-id>C5</external-id>
  <timezone>London</timezone>
  <link rel="self" href="https://movida.bebanjo.net/api/linear_channels/3"/>
  <link rel="linear_schedulings" href="https://movida.bebanjo.net/api/linear_channels/3/linear_schedulings"/>
  <link rel="linear_programs" href="https://movida.bebanjo.net/api/linear_channels/3/linear_programs"/>
  <link rel="linear_categories" href="https://movida.bebanjo.net/api/linear_channels/3/linear_categories"/>
</linear-channel>
{
  "resource_type": "linear_channel",
  "id": 3,
  "name": "Channel 5",
  "external_id": "C5",
  "timezone": "London",
  "self_link": "https://movida.bebanjo.net/api/linear_channels/3",
  "linear_schedulings_link": "https://movida.bebanjo.net/api/linear_channels/3/linear_schedulings",
  "linear_programs_link": "https://movida.bebanjo.net/api/linear_channels/3/linear_programs",
  "linear_categories_link": "https://movida.bebanjo.net/api/linear_channels/3/linear_categories"
}

Valid attributes

  • id (required): Mediagenix On-Demand internal identifier of the linear channel.

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

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

  • timezone (optional): the timezone of the linear channel. The linear schedulings of the channel show their datetime attributes begins_at and ends_at using that attribute if present. If not the default timezone of the account will be used

  • linear_schedulings: The linear schedulings that belong to the linear channel. Only available with Catch-Up enabled.
  • linear_categories: The linear categories that belong to the linear channel. Only available with Linear Planning enabled.
  • linear_programs: The linear programs that belong to the linear channel. Only available with Linear Planning enabled.

Get a list of all linear channels in the current account

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

<?xml version="1.0" encoding="UTF-8"?>
<movida>
  <!-- ... -->
  <link rel="linear_channels" href="https://movida.bebanjo.net/api/linear_channels">
  <!-- ... -->
</movida>
{
  "resource_type": "movida",
  // ...
  "linear_channels_link": "https://movida.bebanjo.net/api/linear_channels",
  // ...
}

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

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/linear_channels
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/linear_channels
<?xml version="1.0" encoding="UTF-8"?>
<linear-channels type="array">
  <linear-channel>
    <id type="integer">3</id>
    <name>BBC 1</name>
    <external-id>BBC1</external-id>
    <timezone nil="true"/>
    <link rel="self" href="https://movida.bebanjo.net/api/linear_channels/3"/>
    <link rel="linear_schedulings" href="https://movida.bebanjo.net/api/linear_channels/3/linear_schedulings"/>
  </linear-channel>
  <linear-channel>
    <id type="integer">4</id>
    <name>BBC 2</name>
    <external-id>BBC2</external-id>
    <timezone>London</timezone>
    <link rel="self" href="https://movida.bebanjo.net/api/linear_channels/4"/>
    <link rel="linear_schedulings" href="https://movida.bebanjo.net/api/linear_channels/4/linear_schedulings"/>
  </linear-channel>
</linear-channels>
{
  "entries": [
    {
      "resource_type": "linear_channel",
      "id": 3,
      "name": "BBC 1",
      "external_id": "BBC1",
      "timezone": null,
      "self_link": "https://movida.bebanjo.net/api/linear_channels/3",
      "linear_schedulings_link": "https://movida.bebanjo.net/api/linear_channels/3/linear_schedulings"
    },
    {
      "resource_type": "linear_channel",
      "id": 4,
      "name": "BBC 2",
      "external_id": "BBC2",
      "timezone": "London",
      "self_link": "https://movida.bebanjo.net/api/linear_channels/4",
      "linear_schedulings_link": "https://movida.bebanjo.net/api/linear_channels/4/linear_schedulings"
    }
  ]
}

You can also filter the list using the following attribute:

  • external_id: This attribute can be used to store the ID of that specific channel in an external system.
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/linear_channels?external_id=BBC2
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/linear_channels?external_id=BBC2
<?xml version="1.0" encoding="UTF-8"?>
<linear-channels type="array">
  <linear-channel>
    <id type="integer">4</id>
    <name>BBC 2</name>
    <external-id>BBC2</external-id>
    <timezone>London</timezone>
    <link rel="self" href="https://movida.bebanjo.net/api/linear_channels/4"/>
    <link rel="linear_schedulings" href="https://movida.bebanjo.net/api/linear_channels/4/linear_schedulings"/>
  </linear-channel>
</linear-channels>
{
  "entries": [
    {
      "resource_type": "linear_channel",
      "id": 4,
      "name": "BBC 2",
      "external_id": "BBC2",
      "timezone": "London",
      "self_link": "https://movida.bebanjo.net/api/linear_channels/4",
      "linear_schedulings_link": "https://movida.bebanjo.net/api/linear_channels/4/linear_schedulings"
    }
  ]
}

Get a single linear channel given its URL

The self link of a Linear Channel contains a URL that will allow us to fetch that individual linear channel:

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/linear_channels/3
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/linear_channels/3
<?xml version="1.0" encoding="UTF-8"?>
<linear-channel>
  <id type="integer">3</id>
  <name>BBC 1</name>
  <external-id>BBC1</external-id>
  <timezone nil="true"/>
  <link rel="self" href="https://movida.bebanjo.net/api/linear_channels/3"/>
  <link rel="linear_schedulings" href="https://movida.bebanjo.net/api/linear_channels/3/linear_schedulings"/>
</linear-channel>
{
  "resource_type": "linear_channel",
  "id": 3,
  "name": "BBC 1",
  "external_id": "BBC1",
  "timezone": null,
  "self_link": "https://movida.bebanjo.net/api/linear_channels/3",
  "linear_schedulings_link": "https://movida.bebanjo.net/api/linear_channels/3/linear_schedulings"
}