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

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>
  <action>publish</action>
  <published-at type="datetime">2008-10-01T00:00:00+01:00</published-at>
  <link href="http://movida.bebanjo.net/api/publication/33" rel="self"/>
  <link href="http://movida.bebanjo.net/api/publication/33/payload" rel="payload"/>
  <link href="http://movida.bebanjo.net/api/publication/33/log" rel="log"/>
  <link href="http://movida.bebanjo.net/api/schedulings/14" rel="scheduling"/>
</publication>

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 href="https://movida.bebanjo.net/api/schedulings/23816/publications" rel="publications"></link>
</scheduling>

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

$ curl --digest -u roboot_user:password 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>
    <action>publish</action>
    <published-at type="datetime">2008-10-01T00:00:00+01:00</published-at>
    <link href="http://movida.bebanjo.net/api/publication/33" rel="self"/>
    <link href="http://movida.bebanjo.net/api/publication/33/payload" rel="payload"/>
    <link href="http://movida.bebanjo.net/api/publication/33/log" rel="log"/>
    <link href="http://movida.bebanjo.net/api/schedulings/14" rel="scheduling"/>
  </publication>
  <publication>
    <id type="integer">34</id>
    <success type="boolean">true</success>
    <action>publish</action>
    <published-at type="datetime">2008-10-02T00:00:00+01:00</published-at>
    <payload><!-- ... --></payload>
    <link href="http://movida.bebanjo.net/api/publication/34" rel="self"/>
    <link href="http://movida.bebanjo.net/api/publication/34/payload" rel="payload"/>
    <link href="http://movida.bebanjo.net/api/publication/34/log" rel="log"/>
    <link href="http://movida.bebanjo.net/api/schedulings/14" rel="scheduling"/>
  </publication>
<publications>

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 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
<publication></publication>
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @publication.xml "http://movida.bebanjo.net/api/schedulings/46/publications"

If the scheduling’s metadata is valid to be published, please note that Movida will not return the XML representing the new publication as publishing is an asynchronous process. Movida 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 Movida 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>
  <action>publish</action>
  <published-at type="datetime">2008-10-01T00:00:00+01:00</published-at>
  <link href="http://movida.bebanjo.net/api/publication/33" rel="self"/>
  <link href="http://movida.bebanjo.net/api/publication/33/payload" rel="payload"/>
  <link href="http://movida.bebanjo.net/api/publication/33/log" rel="log"/>
  <link href="http://movida.bebanjo.net/api/schedulings/14" rel="scheduling"/>
</publication>
$ curl --digest -u roboot_user:password http://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 roboot_user:password http://movida.bebanjo.net/api/publication/33/log

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

Last updated March 31st, 2017.