Skip to content

Movida Resource: Publication

cavalle edited this page Oct 5, 2012 · 23 revisions

NOT IN PRODUCTION YET

Introduction

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>
  <payload>
  <![CDATA[
  <?xml version="1.0" encoding="UTF-8"?>
  <adi:ADI2 xmlns="http://www.cablelabs.com/2006-05-05/Shared" ...>
    <adi:AddMetadataAsset type="Title" product="VOD" groupProviderID="orange.com" ...>
      ...
    </adi:AddMetadataAsset>
  </adi:ADI2>
  ]]>
  </payload>
  <link href="http://movida.example.com/api/publication/33" rel="self"/>
  <link href="http://movida.example.com/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.example.com/api/schedulings/23816/publications" rel="publications"></link>
</scheduling>

If we follow that link, we'll fetch the list of all the publications of that asset.

$ curl --digest -u roboot_user:password https://movida.example.com/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>
    <payload><!-- ... --></payload>
    <link href="http://movida.example.com/api/publication/33" rel="self"/>
    <link href="http://movida.example.com/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.example.com/api/publication/34" rel="self"/>
    <link href="http://movida.example.com/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 Rendition 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.example.com/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 mandatory according to the platform, but it is missing at the moment when the publication is requested). If this is the case Movida will respond with the status code 406 Not Acceptable and a body indicating the metadata validation issues preventing the scheduling to be published. It will be an xml like the following:

Clone this wiki locally