Skip to content

Movida Resource: Linear Scheduling

Luismi Cavallé edited this page Nov 11, 2013 · 16 revisions

IMPORTANT: This resource is not yet available in the API and what's described in this document is tentative and subject to change.

Introduction

A Linear Scheduling is an entry of the schedule of a Linear Channel. It represents a program broadcasted in a TV network in a specific time slot. The term Program is used as a synonym of Linear Scheduling in this documentation.

Note that only Movida accounts configured for catch-up will expose Linear Schedulings in the API.

This is how a Linear Scheduling looks like in the API:

<?xml version="1.0" encoding="UTF-8"?>
<linear-scheduling>
  <id type="integer">1234</id>
  <begins-at type="datetime">2010-10-30T10:30:00Z</begins-at>
  <ends-at type="datetime">2010-10-30T11:30:00Z</ends-at>
  <external-id>A12345</external-id>  
  <link rel="self" href="https://movida.example.com/api/linear_schedulings/1234"/>
  <link rel="title" href="https://movida.example.com/api/titles/123"/>
  <link rel="asset" href="https://movida.example.com/api/assets/234"/>
  <link rel="linear_channel" href="https://movida.example.com/api/linear_channels/3"/>
</linear-scheduling>

GET the list of all the Linear Schedulings of a Channel

Linear Schedulings are accessed from the Linear Channel they are related to through the link identified as rel="linear_schedulings":

<?xml version="1.0" encoding="UTF-8"?>
<linear-channel>
  <id type="integer">3</id>
  <name>BBC 1</name>
  <external-id>BBC1</external-id>
  <link rel="self" href="https://movida.example.com/api/linear_channels/3"/>
  <link rel="linear_schedulings" href="https://movida.example.com/api/linear_channels/3/linear_schedulings"/>  
</linear-channel>

Following that link, we can fetch the Channel's Linear Schedulings.

$ curl --digest -u robot_user:password https://movida.example.com/api/linear_channels/3/linear_schedulings
<?xml version="1.0" encoding="UTF-8"?>
<linear-schedulings>
  <total-entries>4304</total-entries>
  <link rel="next" href="https://movida.bebanjo.net/api/linear_channels/3/linear_schedulings?page=1"/>
  <link rel="prev" href="https://movida.bebanjo.net/api/linear_channels/3/linear_schedulings?page=3"/>
  <linear-scheduling>
    <id type="integer">1234</id>
    <begins-at type="datetime">2010-10-30T10:30:00Z</begins-at>
    <ends-at type="datetime">2010-10-30T11:30:00Z</ends-at>
    <external-id>BBC123456</external-id>  
    <link rel="self" href="https://movida.example.com/api/linear_schedulings/1234"/>
    <link rel="title" href="https://movida.example.com/api/titles/123"/>
    <link rel="asset" href="https://movida.example.com/api/assets/234"/>
    <link rel="linear_channel" href="https://movida.example.com/api/linear_channels/3"/>
  </linear-scheduling>
  <linear-scheduling>
    <id type="integer">1235</id>
    <begins-at type="datetime">2010-10-30T11:30:00Z</begins-at>
    <ends-at type="datetime">2010-10-30T12:30:00Z</ends-at>
    <external-id>BBC2222222</external-id>  
    <link rel="self" href="https://movida.example.com/api/linear_schedulings/1235"/>
    <link rel="title" href="https://movida.example.com/api/titles/233"/>
    <link rel="asset" href="https://movida.example.com/api/assets/745"/>
    <link rel="linear_channel" href="https://movida.example.com/api/linear_channels/3"/>
  </linear-scheduling>
  <!-- ... -->
<linear-schedulings>

The list of Linear Schedulings of the Channel will be returned sorted by begins-at date.

Note that this is a paginated resource. By default, only 50 linear_schedulings 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.

Accepted Parameters

You can filter the list of Linear Schedulings returned using the following parameters:

from – It will return only Linear Schedulings ending after the given date. The value has to be a valid ISO 8601 datetime (e.g. 2010-10-10T10:30:20Z). The Timezone is optional and when omitted the default timezone of the account will be used. The Time is also optional and when omitted 00:00:00 will be used.

to – It will return only Linear Schedulings starting before the given date. The value has to be a valid ISO 8601 datetime (e.g. 2010-10-10T10:30:20Z). The Timezone is optional and when omitted the default timezone of the account will be used. The Time is also optional and when omitted 23:59:59 will be used.

external_id – It will return only the Linear Scheduling 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.

These three parameters can be combined and, when so, only the Linear Schedulings satisfying all the filters will be returned.

GET a single Linear Scheduling given its URL

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

$ curl --digest -u robot_user:password https://movida.example.com/api/linear_scheduling/1234
<?xml version="1.0" encoding="UTF-8"?>
<linear-scheduling>
  <id type="integer">1234</id>
  <begins-at type="datetime">2010-10-30T10:30:00Z</begins-at>
  <ends-at type="datetime">2010-10-30T11:30:00Z</ends-at>
  <external-id>BBC123456</external-id>  
  <link rel="self" href="https://movida.example.com/api/linear_schedulings/1234"/>
  <link rel="title" href="https://movida.example.com/api/titles/123"/>
  <link rel="asset" href="https://movida.example.com/api/assets/234"/>
  <link rel="linear_channel" href="https://movida.example.com/api/linear_channels/3"/>
</linear-scheduling>

Create a new Linear Scheduling for a Channel

To create a Linear Scheduling, you just need to POST the proper XML representation of a Linear Scheduling (similar to the ones you get when fetching) to the URL that you can find in the link rel="linear_schedulings" of the Linear Channel you want to add the Linear Scheduling to.

For example, this POST would create a Linear Scheduling: (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"?>
<linear-scheduling>
  <begins-at type="datetime">2010-10-30T10:30:00Z</begins-at>
  <ends-at type="datetime">2010-10-30T11:30:00Z</ends-at>
  <external-id>BBC123456</external-id>  
  <link rel="title" href="https://movida.example.com/api/titles/123"/>
  <link rel="asset" href="https://movida.example.com/api/assets/234"/>
</linear-scheduling>
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @payload.xml "https://movida.example.com/api/linear_channels/3/linear_schedulings"

Movida will return the full XML of the Linear Scheduling just created:

<?xml version="1.0" encoding="UTF-8"?>
<linear-scheduling>
  <id type="integer">1234</id>
  <begins-at type="datetime">2010-10-30T10:30:00Z</begins-at>
  <ends-at type="datetime">2010-10-30T11:30:00Z</ends-at>
  <external-id>BBC123456</external-id>  
  <link rel="self" href="https://movida.example.com/api/linear_schedulings/1234"/>
  <link rel="title" href="https://movida.example.com/api/titles/123"/>
  <link rel="asset" href="https://movida.example.com/api/assets/234"/>
  <link rel="linear_channel" href="https://movida.example.com/api/linear_channels/3"/>
</linear-scheduling>

Please, see in a section below a few remarks to bear in mind when creating a Linear Scheduling.

Updating a linear scheduling

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

$ cat payload.xml
<?xml version="1.0" encoding="UTF-8"?>
<linear-scheduling>
  <begins-at type="datetime">2010-10-30T11:30:00Z</begins-at>
  <ends-at type="datetime">2010-10-30T12:30:00Z</ends-at>
</linear-scheduling>
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @payload.xml "https://movida.example.com/api/linear_schedulings/1234"

Movida will return the full XML of the linear scheduling just updated:

<?xml version="1.0" encoding="UTF-8"?>
<linear-scheduling>
  <id type="integer">1234</id>
  <begins-at type="datetime">2010-10-30T11:30:00Z</begins-at>
  <ends-at type="datetime">2010-10-30T12:30:00Z</ends-at>
  <external-id>BBC123456</external-id>  
  <link rel="self" href="https://movida.example.com/api/linear_schedulings/1234"/>
  <link rel="title" href="https://movida.example.com/api/titles/123"/>
  <link rel="asset" href="https://movida.example.com/api/assets/234"/>
  <link rel="linear_channel" href="https://movida.example.com/api/linear_channels/3"/>
</linear-scheduling>

Please, see in a section below a few remarks to bear in mind when updating a Linear Scheduling.

Deleting a Linear Scheduling

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

$ curl --digest -u robot_user:password -X DELETE "https://movida.example.com/api/linear_schedulings/1234"

Please, see in a section below a few remarks to bear in mind when deleting a Linear Scheduling.

Remarks when creating, updating and deleting a linear scheduling

  • The begins-at and ends-at of a Linear Scheduling must never overlap with any other existing Linear Scheduling in the same Channel. When a creation or an update of a Linear Scheduling would violate this constrain, a validation error will be returned.

  • If the asset link is given when POSTing or PUTing a Linear Scheduling, then there's no need to specify the title link as this will be set automatically to the title of the asset.

  • After creating, updating or deleting a Linear Scheduling, Movida will automatically reapply whatever Catch-up Rights and Rules might affect to the Title of the Linear Scheduling. That means that the VOD Schedule is always kept consistent with the changes in the Linear Schedule according to the Rights and Rules recorded in the current account.

Clone this wiki locally