Skip to content

Developers

How can we help you?

← Go back

Publication

A publication is the resource that represents the fact that a Scheduling’s metadata has been (or wants to be) published in its platform.

A published publication looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<publication>
  <id type="integer">33</id>
  <success type="boolean">true</success>
  <published-at type="datetime">2020-11-17T10:20:03Z</published-at>
  <link rel="self" href="https://movida.bebanjo.net/api/publication/33"/>
  <link rel="scheduling" href="https://movida.bebanjo.net/api/schedulings/14"/>
  <link rel="payload" href="https://movida.bebanjo.net/api/publications/33/payload"/>
  <link rel="log" href="https://movida.bebanjo.net/api/publications/33/log"/>
</publication>
{
  "resource_type": "publication",
  "id": 33,
  "success": true,
  "published_at": "2020-11-17T10:20:03Z",
  "self_link": "https://movida.bebanjo.net/api/publications/33",
  "scheduling_link": "https://movida.bebanjo.net/api/schedulings/14",
  "payload_link": "https://movida.bebanjo.net/api/publications/33/payload",
  "log_link": "https://movida.bebanjo.net/api/publications/33/log"
}

Get a list of all publications of a scheduling

publications are accessed via the scheduling they are related to, as in the example below, through the link identified by the rel="publications" attribute:

<?xml version='1.0' encoding='utf-8' ?>
<scheduling>
  <id type='integer'>23816</id>
  <put-up type='datetime'>2010-04-01T00:00:00Z</put-up>
  <take-down type='datetime'>2010-06-01T21:59:59Z</take-down>
  <!-- ... -->
  <link rel="publications" href="https://movida.bebanjo.net/api/schedulings/23816/publications"/>
  <!-- ... -->
</scheduling>
{
  "resource_type": "scheduling",
  "id": 23816,
  "put_up": "2010-04-01T00:00:00Z",
  "take_down": "2010-06-01T21:59:59Z",
  // ...
  "publications_link": "https://movida.bebanjo.net/api/schedulings/23816/publications",
  // ...
}

If we follow that link, we’ll fetch the list of all the publications of that scheduling.

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/schedulings/23816/publications
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/schedulings/23816/publications
<?xml version="1.0" encoding="UTF-8"?>
<publications type="array">
  <publication>
    <id type="integer">33</id>
    <success type="boolean">false</success>
    <published-at type="datetime">2019-01-10T08:43:39Z</published-at>
    <link rel="self" href="https://movida.bebanjo.net/api/publication/33"/>
    <link rel="scheduling" href="https://movida.bebanjo.net/api/schedulings/14"/>
    <link rel="payload" href="https://movida.bebanjo.net/api/publication/33/payload"/>
    <link rel="log" href="https://movida.bebanjo.net/api/publication/33/log"/>
  </publication>
  <publication>
    <id type="integer">34</id>
    <success type="boolean">true</success>
    <published-at type="datetime">2008-10-02T00:00:00+01:00</published-at>
    <link rel="self" href="https://movida.bebanjo.net/api/publication/34"/>
    <link rel="scheduling" href="https://movida.bebanjo.net/api/schedulings/14"/>
    <link rel="payload" href="https://movida.bebanjo.net/api/publication/34/payload"/>
    <link rel="log" href="https://movida.bebanjo.net/api/publication/34/log"/>
  </publication>
<publications>
{
  "entries": [
    {
      "resource_type": "publication",
      "id": 33,
      "success": false,
      "published_at": "2019-01-10T08:43:39Z",
      "self_link": "https://movida.bebanjo.net/api/publications/33",
      "scheduling_link": "https://movida.bebanjo.net/api/schedulings/14",
      "payload_link": "https://movida.bebanjo.net/api/publications/33/payload",
      "log_link": "https://movida.bebanjo.net/api/publications/33/log"
    },
    {
      "resource_type": "publication",
      "id": 34,
      "success": true,
      "published_at": "2019-01-12T14:18:47Z",
      "self_link": "https://movida.bebanjo.net/api/publications/34",
      "scheduling_link": "https://movida.bebanjo.net/api/schedulings/14",
      "payload_link": "https://movida.bebanjo.net/api/publications/34/payload",
      "log_link": "https://movida.bebanjo.net/api/publications/34/log"
    }
  ]
}

Publishing a scheduling

To publish a scheduling, what you do is to create a new publication. For that you just need to POST an empty XML/JSON publication representation to the proper URL. As explained above, that URL is in the link node whose rel attribute equals publications in the scheduling.

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

$ cat publication.xml
$ cat publication.json
<publication></publication>
{}
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @publication.xml "https://movida.bebanjo.net/api/schedulings/46/publications"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @publication.json "https://movida.bebanjo.net/api/schedulings/46/publications"

If the scheduling’s metadata is valid to be published, please note that Mediagenix On-Demand will not return the XML/JSON representing the new publication as publishing is an asynchronous process. Mediagenix On-Demand will respond with the HTTP status code 202 Accepted meaning that a publication job has been created and it’ll be processed as soon as possible. Whenever the publication is done, it will appear as part of the list of publications explained above.

It might happen that the scheduling’s metadata is not ready to be published (e.g. the synopsis of the title is required by the platform, but it’s missing at the moment when the publication is requested). If this is the case Mediagenix On-Demand will respond with the status code 422 Unprocessable Entity and a body indicating the metadata validation issues preventing the scheduling from being published.

Payload and log of the publication

Each publication has two nested resources: the payload, which contains the published payload, and the log, with the log of the action. Both can be accessed using a GET verb.

<?xml version="1.0" encoding="UTF-8"?>
<publication>
  <id type="integer">33</id>
  <success type="boolean">true</success>
  <published-at type="datetime">2020-11-17T10:20:03Z</published-at>
  <link rel="self" href="https://movida.bebanjo.net/api/publication/33"/>
  <link rel="scheduling" href="https://movida.bebanjo.net/api/schedulings/14"/>
  <link rel="payload" href="https://movida.bebanjo.net/api/publication/33/payload"/>
  <link rel="log" href="https://movida.bebanjo.net/api/publication/33/log"/>
</publication>
{
  "resource_type": "publication",
  "id": 33,
  "success": true,
  "published_at": "2020-11-17T10:20:03Z",
  "self_link": "https://movida.bebanjo.net/api/publications/33",
  "scheduling_link": "https://movida.bebanjo.net/api/schedulings/14",
  "payload_link": "https://movida.bebanjo.net/api/publications/33/payload",
  "log_link": "https://movida.bebanjo.net/api/publications/33/log"
}
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/publication/33/payload
<movie contentProviderId="ocs" id="SFR-HARRYPOTTERW0057946Z" xmlns="http://www.wiztivi.com/wsp/vod/xsd/Contents">
  <availabilityDate>1362733200000</availabilityDate>
  <expirationDate>1365273600000</expirationDate>
  <restrictions>
    <restriction id="csa-2">
      <type>csa</type>
      <value>2</value>
    </restriction>
  </restrictions>
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/publication/33/log

Connected to ftp.example.com
Uploaded HARRYPOTTERW0057946_cover.jpg
Uploaded HARRYPOTTERW0057946.xml
Connection closed