Skip to content

Developers

How can we help you?

← Go back

Deal

Note: This resource links can be expanded using the expand option except the rights, licensor, granted_requirements and specific_platforms links.

A deal provides a way to store all rights information as agreed in a licensing deal, where a set of umbrella rights will be agreed (license windows, business models, devices, platforms, etc.) and a list of features or series with equal or different availability windows will be governed by them.

This is how an archive deal looks like:

<?xml version="1.0" encoding="UTF-8"?>
<deal>
  <id type="integer">123</id>
  <name>Marvel deal 2013</name>
  <external-id>Marvel2013</external-id>
  <right-type>archive</right-type>
  <starts type="datetime">2014-10-10T00:00:00Z</starts>
  <ends type="datetime">2015-10-31T00:00:00Z</ends>
  <rights-updated-at type="datetime">2014-10-01T00:00:00Z</rights-updated-at>
  <utility-limit type="integer">3</utility-limit>
  <repeats type="boolean">false</repeats>
  <minimum-exploitation type="integer">10</minimum-exploitation>
  <maximum-exploitation type="integer">30</maximum-exploitation>
  <exploitation-limits-context>total</exploitation-limits-context>
  <rerun-limit type="integer">15</rerun-limit>
  <parity>start+end</parity>
  <link rel="self" href="https://movida.bebanjo.net/api/deals/123"/>
  <link rel="rights" href="https://movida.bebanjo.net/api/deals/123/rights"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/deals/123/metadata"/>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensors/114"/>
  <link rel="granted_requirements" href="https://movida.bebanjo.net/api/deals/123/granted_requirements"/>
  <link rel="specific_platforms" href="https://movida.bebanjo.net/api/deals/123/specific_platforms"/>
</deal>
{
  "resource_type": "deal",
  "id": 123,
  "name": "Marvel deal 2013",
  "external_id": "Marvel2013",
  "right_type": "archive",
  "starts": "2014-10-10T00:00:00Z",
  "ends": "2015-10-31T00:00:00Z",
  "rights_updated_at": "2014-10-01T00:00:00Z",
  "utility_limit": 3,
  "repeats": false,
  "minimum_exploitation": 10,
  "maximum_exploitation": 30,
  "exploitation_limits_context": "total",
  "rerun_limit": 15,
  "parity": "start+end",
  "self_link": "https://movida.bebanjo.net/api/deals/123",
  "rights_link": "https://movida.bebanjo.net/api/deals/123/rights",
  "metadata_link": "https://movida.bebanjo.net/api/deals/123/metadata",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/114",
  "granted_requirements_link": "https://movida.bebanjo.net/api/deals/123/granted_requirements",
  "specific_platforms_link": "https://movida.bebanjo.net/api/deals/123/specific_platforms"
}

This is how an Catch-up deal looks like:

<deal>
  <id type="integer">1234</id>
  <name>Marvel deal 2014</name>
  <external-id>Marvel2014</external-id>
  <right-type>catchup</right-type>
  <transmission-type>play_run</transmission-type>
  <reference-tx-nth>1</reference-tx-nth>
  <reference-tx-from type="datetime">2010-01-07T00:00Z</reference-tx-from>
  <reference-tx-to type="datetime">2011-01-07T00:00Z</reference-tx-to>
  <start-offset-value type="integer">1</start-offset-value>
  <start-offset-unit>hours</start-offset-unit>
  <start-offset-reference>after_tx_ends</start-offset-reference>
  <start-fixed-time nil="true"/>
  <end-offset-value type="integer">30</end-offset-value>
  <end-offset-unit>days</end-offset-unit>
  <end-offset-reference>after_tx_ends</end-offset-reference>
  <end-fixed-time nil="true"/>
  <rights-updated-at nil="true"/>
  <utility-limit type="integer">3</utility-limit>
  <repeats type="boolean">false</repeats>
  <minimum-exploitation type="integer">10</minimum-exploitation>
  <maximum-exploitation type="integer">30</maximum-exploitation>
  <exploitation-limits-context>total</exploitation-limits-context>
  <rerun-limit type="integer">15</rerun-limit>
  <parity>start+end</parity>
  <link rel="self" href="https://movida.bebanjo.net/api/deals/1234"/>
  <link rel="rights" href="https://movida.bebanjo.net/api/deals/1234/rights"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/deals/1234/metadata"/>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensors/114"/>
  <link rel="granted_requirements" href="https://movida.bebanjo.net/api/deals/1234/granted_requirements"/>
  <link rel="specific_platforms" href="https://movida.bebanjo.net/api/deals/1234/specific_platforms"/>
</deal>
{
  "resource_type": "deal",
  "id": 1234,
  "name": "Marvel deal 2014",
  "external_id": "Marvel2014",
  "right_type": "catchup",
  "transmission_type": "play_run",
  "reference_tx_nth": "1",
  "reference_tx_from": "2010-01-07T00:00Z",
  "reference_tx_to": "2011-01-07T00:00Z",
  "start_offset_value": 1,
  "start_offset_unit": "hours",
  "start_offset_reference": "after_tx_ends",
  "start_fixed_time": null,
  "end_offset_value": 30,
  "end_offset_unit": "days",
  "end_offset_reference": "after_tx_ends",
  "end_fixed_time": null,
  "rights_updated_at": null,
  "utility_limit": 3,
  "repeats": false,
  "minimum_exploitation": 10,
  "maximum_exploitation": 30,
  "exploitation_limits_context": "total",
  "rerun_limit": 15,
  "parity": "start+end",
  "self_link": "https://movida.bebanjo.net/api/deals/1234",
  "rights_link": "https://movida.bebanjo.net/api/deals/1234/rights",
  "metadata_link": "https://movida.bebanjo.net/api/deals/1234/metadata",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/114",
  "granted_requirements_link": "https://movida.bebanjo.net/api/deals/1234/granted_requirements",
  "specific_platforms_link": "https://movida.bebanjo.net/api/deals/1234/specific_platforms"
}

Deal attributes

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

  • name (required): the name of the deal.

  • external-id (optional): the identifier of the deal in the external system.

  • right-type (required): the type of the rights the deal is composed of. Possible values are “archive” and “catchup”.

  • rights-updated-at (read_only): a timestamp indicating when the rights association with the deal has been updated the last time, in ISO8601 format. Will be nil if there is no rights elements yet. This value is refreshed when:

    • Any granted requirement is added to, updated or removed from the deal
    • Any right is added to, updated or removed from the deal
  • utility-limit (optional): indicates the maximum number of episodes on a series that can be available to any one time. So this attribute can only be inherited by rights applied to series. Allowed values are: nil (if theres is no such restriction) and positive integers greater than 0.

  • repeats (optional): if not specified at creation it will defaut to false. Indicates if an episode cannot be repeated until all episodes in the series have been scheduled. So this attribute can only be inherited by rights applied to series. Allowed values are: true or false.

  • minimum-exploitation (optional): indicates the minimum duration in days on exploitation. Allowed values are: nil (if there is no such limit) and integer values greater or equal than 0. If a value maximum_explotation is provided too must be lower than that.

  • maximum-exploitation (optional): indicates the maximum duration in days on exploitation. Allowed values are: nil (if there is no such limit) and integer values greater or equal than 0. If a value minimum_explotation is provided too must be higher than that.

  • exploitation-limits-context (optional): this attribute only makes sense if any or both exploitation limits are set. Allowed values are: total and window. Its purpose is to specify the behaviour while applying such limits:

    • total. They will be applied as a group to all the schedule entries for each platform. This is the default behaviour.

    • window. The limits will be applied individualy for each schedule entry.

  • rerun-limit (optional): indicates the max allowed number of schedule entries in the same platform and within the availability window. Allowed values are: nil (if there is no such limit) and integer values greater or equal than 1.

  • parity (optional): indicates if schedule entries must be specified en every platform with the same: start date, end date or same start and end dates. Allowed values are: nil (if there is no such restriction), start, end, and start+end.

Archive deal context

  • starts (optional): the date from which the deal applies.

  • ends (optional): the date until which the deal applies.

Catch-up deal context

  • starts (optional): the date from which the deal applies.

  • ends (optional): the date until which the deal applies.

  • start-offset-value (optional): define when the deal starts. Allowed values are positive integers. If specified you need to provide <start-offset-unit> and <start-offset-reference> to define the start completely.

  • start-offset-unit (optional): define when the deal starts. Allowed values are: minutes, hours, days, weeks, months, years. If specified you need to provide <start-offset-value> and <start-offset-reference> to define the start completely.

  • start-offset-reference (optional): define when the deal starts. Allowed values are: before_tx_starts, after_tx_starts, after_tx_ends, after_last_episode_starts and after_last_episode_ends. If specified you need to provide <start-offset-value> and <start-offset-reference> to define the start completely.

  • start-fixed-time (optional): define when the deal starts at a given hour. Values for this field should be provided in the format “hh:mm”. This attribute can only be set when start-offset-unit is set to days, weeks, months, years.

  • end-offset-value (optional): define when the deal ends. Allowed values are positive integers. If specified you need to provide <end-offset-unit> and <end-offset-reference> to define the end completely.

  • end-offset-unit (optional): define when the deal ends. Allowed values are: minutes, hours, days, weeks, months, years. If specified you need to provide <end-offset-value> and <end-offset-reference> to define the end completely.

  • end-offset-reference (optional): define when the deal ends. Allowed values are: after_start, after_tx_ends and after_last_episode. If specified you need to provide <end-offset-value> and <end-offset-unit> to define the end completely.

  • end-fixed-time (optional): define when the deal ends at a given hour. Values for this field should be provided in the format “hh:mm”. This attribute can only be set when <end-offset-unit> is set to days, weeks, months, years.

  • reference-tx-nth (required): ordinal value representing what linear schedulings will be used. Allowed values are: all, a specific number or a range of numbers, separating the numbers by commas or by a dash. A dash range means that all the numbers in that range are included. Can’t be longer than 255 characters. When the link identified with the rel="transmission_content" attribute is present, the all value is not allowed.

  • transmission-type (required): define the transmission type criteria to select the linear scheduling that will be used. Can take the following values:
    • play_run: consider the play run number of linear schedulings, which is the transmission number of the linear schedulings across linear channels.
    • costed_run: consider the run number in contract of linear schedulings, which is the costed run of the linear schedulings across linear channels.
    • rerun: consider the number of reruns of a linear scheduling.

    Note: Deprecated feature.

    Currently when no transmission-type is specified the value play_run is taken as default. The play_run value matches the transmission selection criteria present before the transmission-type attribute was available in the API.

    Please note that this behaviour is deprecated, and you shouldn’t rely on it in your integration. In the future, you will get an error when creating a rule without explicitly setting the transmission-type to be used.

  • linear-contract-id (optional): an unique identifier for a Linear contract. It allows to target costed run and reruns for the Linear contract specified. This attribute only makes sense when <transmission-type> has the value costed_run or rerun. Can’t be longer than 255 characters.

  • include-reruns (optional): this attribute only makes sense when <transmission-type> has the value costed_run. It allows to target reruns per costed run, eg. to use linear schedulings with rerun attribute included in include-reruns value. Allowed values are: all, a specific number or a range of numbers, separating the numbers by commas or by a dash. A dash range means that all the numbers in that range are included. Can’t be longer than 255 characters.

  • reference-tx-from (optional): timestamp representing what linear schedulings will be taken into account using their begins-at attribute.

  • reference-tx-to (optional): timestamp representing what linear schedulings will be taken into account using their ends-at attribute.

Catch-up deals can specify a different linear content through the link identified with the rel="transmission_content" attribute:

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

All episodes or titles of the transmission content are considered when taking into account linear schedulings.

Get a list of all deals in the account

Note: that this is a paginated resource. By default, only 50 deals 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" provide the next and the previous pages links.

Deals are linked from the root of the API, through the link identified with the rel="deals" attribute:

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

Following that link, we can fetch the list of deals in the current account:

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/deals
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/deals
<?xml version='1.0' encoding='utf-8' ?>
<deals type="array">
  <total-entries>2</total-entries>
  <link rel="next" href="https://movida.bebanjo.net/api/deals?page=2"/>
  <deal>
    <id type="integer">2</id>
    <name>Marvel Deal 2013</name>
    <external-id>Marvel2013</external-id>
    <right-type>archive</right-type>
    <starts type="datetime">2014-10-10T00:00:00Z</starts>
    <ends type="datetime">2015-10-31T00:00:00Z</ends>
    <rights-updated-at type='datetime'>2014-10-26T04:47:09Z</rights-updated-at>
    <utility-limit nil="true"/>
    <repeats type="boolean">false</repeats>
    <minimum-exploitation nil="true"/>
    <maximum-exploitation nil="true"/>
    <exploitation-limits-context nil="true"/>
    <rerun-limit nil="true"/>
    <parity nil="true"/>
    <link rel="self" href="https://movida.bebanjo.net/api/deals/2"/>
    <link rel="rights" href="https://movida.bebanjo.net/api/deals/2/rights"/>
    <link rel="metadata" href="https://movida.bebanjo.net/api/deals/2/metadata"/>
    <link rel="granted_requirements" href="https://movida.bebanjo.net/api/deals/2/granted_requirements"/>
    <link rel="specific_platforms" href="https://movida.bebanjo.net/api/deals/2/specific_platforms"/>
  </deal>
  <deal>
    <id type="integer">4</id>
    <name>Supply License #1 : A3MI </name>
    <external-id></external-id>
    <right-type>archive</right-type>
    <starts type="datetime">2014-06-10T00:00:00Z</starts>
    <ends type="datetime">2015-07-01T00:00:00Z</ends>
    <rights-updated-at type='datetime'>2014-06-01T04:47:09Z</rights-updated-at>
    <utility-limit type="integer">3</utility-limit>
    <repeats type="boolean">false</repeats>
    <minimum-exploitation nil="true"/>
    <maximum-exploitation nil="true"/>
    <exploitation-limits-context nil="true"/>
    <rerun-limit nil="true"/>
    <parity nil="true"/>
    <link rel="self" href="https://movida.bebanjo.net/api/deals/4"/>
    <link rel="rights" href="https://movida.bebanjo.net/api/deals/4/rights"/>
    <link rel="metadata" href="https://movida.bebanjo.net/api/deals/4/metadata"/>
    <link rel="granted_requirements" href="https://movida.bebanjo.net/api/deals/4/granted_requirements"/>
    <link rel="specific_platforms" href="https://movida.bebanjo.net/api/deals/4/specific_platforms"/>
  </deal>
</deals>
{
  "total_entries": 2,
  "next_link": "https://movida.bebanjo.net/api/deals?page=2",
  "entries": [
    {
      "resource_type": "deal",
      "id": 2,
      "name": "Marvel Deal 2013",
      "external_id": "Marvel2013",
      "right_type": "archive",
      "starts": "2014-10-10T00:00:00Z",
      "ends": "2015-10-31T00:00:00Z",
      "rights_updated_at": "2014-10-26T04:47:09Z",
      "utility_limit": null,
      "repeats": false,
      "minimum_exploitation": null,
      "maximum_exploitation": null,
      "exploitation_limits_context": null,
      "rerun_limit": null,
      "parity": null,
      "self_link": "https://movida.bebanjo.net/api/deals/2",
      "rights_link": "https://movida.bebanjo.net/api/deals/2/rights",
      "metadata_link": "https://movida.bebanjo.net/api/deals/2/metadata",
      "granted_requirements_link": "https://movida.bebanjo.net/api/deals/2/granted_requirements",
      "specific_platforms_link": "https://movida.bebanjo.net/api/deals/2/specific_platforms"
    },
    {
      "resource_type": "deal",
      "id": 4,
      "name": "Supply License #1 : A3MI ",
      "external_id": null,
      "right_type": "archive",
      "starts": "2014-06-10T00:00:00Z",
      "ends": "2015-07-01T00:00:00Z",
      "rights_updated_at": "2014-06-01T04:47:09Z",
      "utility_limit": 3,
      "repeats": false,
      "minimum_exploitation": null,
      "maximum_exploitation": null,
      "exploitation_limits_context": null,
      "rerun_limit": null,
      "parity": null,
      "self_link": "https://movida.bebanjo.net/api/deals/4",
      "rights_link": "https://movida.bebanjo.net/api/deals/4/rights",
      "metadata_link": "https://movida.bebanjo.net/api/deals/4/metadata",
      "granted_requirements_link": "https://movida.bebanjo.net/api/deals/4/granted_requirements",
      "specific_platforms_link": "https://movida.bebanjo.net/api/deals/4/specific_platforms"
    }
  ]
}

You can also pass other attributes to limit the results:

  • external_id: You can filter the list of deals by passing in an external_id. This attribute can be used to store the ID of that specific deal in an external system.

  • per_page: Number of elements returned in each page. The maximum value allowed is 200 and the default is 50.

Here is an example passing the external_id:

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/deals?external_id=Marvel2013
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/deals?external_id=Marvel2013
<?xml version='1.0' encoding='utf-8' ?>
<deals type='array'>
  <total-entries>1</total-entries>
  <deal>
    <id type="integer">2</id>
    <name>Marvel Deal 2013</name>
    <external-id>Marvel2013</external-id>
    <right-type>archive</right-type>
    <starts type="datetime">2014-06-10T00:00:00Z</starts>
    <ends type="datetime">2015-07-01T00:00:00Z</ends>
    <rights-updated-at type='datetime'>2014-10-26T04:47:09Z</rights-updated-at>
    <utility-limit type="integer">3</utility-limit>
    <repeats type="boolean">false</repeats>
    <minimum-exploitation nil="true"/>
    <maximum-exploitation nil="true"/>
    <exploitation-limits-context nil="true"/>
    <rerun-limit nil="true"/>
    <parity nil="true"/>
    <link rel="self" href="https://movida.bebanjo.net/api/deals/2"/>
    <link rel="rights" href="https://movida.bebanjo.net/api/deals/2/rights"/>
    <link rel="metadata" href="https://movida.bebanjo.net/api/deals/2/metadata"/>
    <link rel="granted_requirements" href="https://movida.bebanjo.net/api/deals/2/granted_requirements"/>
    <link rel="specific_platforms" href="https://movida.bebanjo.net/api/deals/2/specific_platforms"/>
  </deal>
</deals>
{
  "total_entries": 1,
  "entries": [
    {
      "resource_type": "deal",
      "id": 2,
      "name": "Marvel Deal 2013",
      "external_id": "Marvel2013",
      "right_type": "archive",
      "starts": "2014-06-10T00:00:00Z",
      "ends": "2015-07-01T00:00:00Z",
      "rights_updated_at": "2014-10-26T04:47:09Z",
      "utility_limit": 3,
      "repeats": false,
      "minimum_exploitation": null,
      "maximum_exploitation": null,
      "exploitation_limits_context": null,
      "rerun_limit": null,
      "parity": null,
      "self_link": "https://movida.bebanjo.net/api/deals/2",
      "rights_link": "https://movida.bebanjo.net/api/deals/2/rights",
      "metadata_link": "https://movida.bebanjo.net/api/deals/2/metadata",
      "granted_requirements_link": "https://movida.bebanjo.net/api/deals/2/granted_requirements",
      "specific_platforms_link": "https://movida.bebanjo.net/api/deals/2/specific_platforms"
    }
  ]
}

Get a single deal

Just do a GET to the URI of the deal (the one in the attribute rel="self"):

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/deals/2
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/deals/2
<?xml version='1.0' encoding='utf-8' ?>
<deal>
  <id type="integer">2</id>
  <name>Marvel Deal 2013</name>
  <external-id>Marvel2013</external-id>
  <right-type>archive</right-type>
  <starts type="datetime">2014-06-10T00:00:00Z</starts>
  <ends type="datetime">2015-07-01T00:00:00Z</ends>
  <rights-updated-at type='datetime'>2014-06-01T04:47:09Z</rights-updated-at>
  <utility-limit type="integer">3</utility-limit>
  <repeats type="boolean">false</repeats>
  <minimum-exploitation nil="true"/>
  <maximum-exploitation nil="true"/>
  <exploitation-limits-context nil="true"/>
  <rerun-limit nil="true"/>
  <parity nil="true"/>
  <link rel="self" href="https://movida.bebanjo.net/api/deals/2"/>
  <link rel="rights" href="https://movida.bebanjo.net/api/deals/2/rights"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/deals/2/metadata"/>
  <link rel="granted_requirements" href="https://movida.bebanjo.net/api/deals/2/granted_requirements"/>
  <link rel="specific_platforms" href="https://movida.bebanjo.net/api/deals/2/specific_platforms"/>
</deal>
{
  "resource_type": "deal",
  "id": 2,
  "name": "Marvel Deal 2013",
  "external_id": "Marvel2013",
  "right_type": "archive",
  "starts": "2014-06-10T00:00:00Z",
  "ends": "2015-07-01T00:00:00Z",
  "rights_updated_at": "2014-06-01T04:47:09Z",
  "utility_limit": 3,
  "repeats": false,
  "minimum_exploitation": null,
  "maximum_exploitation": null,
  "exploitation_limits_context": null,
  "rerun_limit": null,
  "parity": null,
  "self_link": "https://movida.bebanjo.net/api/deals/2",
  "rights_link": "https://movida.bebanjo.net/api/deals/2/rights",
  "metadata_link": "https://movida.bebanjo.net/api/deals/2/metadata",
  "granted_requirements_link": "https://movida.bebanjo.net/api/deals/2/granted_requirements",
  "specific_platforms_link": "https://movida.bebanjo.net/api/deals/2/specific_platforms"
}

Create a new deal

To create a deal, you just need to POST the proper XML/JSON representation of a deal (similar to the ones you get when fetching) to the URL that you can find in the link rel="deals" of the root of the API.

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

$ cat payload.xml
$ cat payload.json
<?xml version='1.0' encoding='utf-8' ?>
<deal>
  <name>Marvel deal 2013</name>
  <external-id>Marvel2013</external-id>
  <right-type>archive</right-type>
  <starts type="datetime">2014-06-10</starts>
  <ends type="datetime">2015-07-01</ends>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensors/4"/>
</deal>
{
  "name": "Marvel deal 2013",
  "external_id": "Marvel2013",
  "right_type": "archive",
  "starts": "2014-06-10",
  "ends": "2015-07-01",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/4"
}

Note: The licensor URL must be of one licensor that already exists in the system, otherwise you will receive a message error reporting the licensor doesn’t exist. See how to create licensors in the licensor page.

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @payload.xml "https://movida.bebanjo.net/api/deals"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @payload.json "https://movida.bebanjo.net/api/deals"

Mediagenix On-Demand will return the full XML/JSON of the deal just created:

<?xml version='1.0' encoding='utf-8' ?>
<deal>
  <id type="integer">2</id>
  <name>Marvel deal 2013</name>
  <external-id>Marvel2013</external-id>
  <right-type>archive</right-type>
  <starts type="datetime">2014-06-10T00:00:00Z</starts>
  <ends type="datetime">2015-07-01T00:00:00Z</ends>
  <rights-updated-at nil="true"/>
  <utility-limit nil="true"/>
  <repeats type="boolean">false</repeats>
  <minimum-exploitation nil="true"/>
  <maximum-exploitation nil="true"/>
  <exploitation-limits-context nil="true"/>
  <rerun-limit nil="true"/>
  <parity nil="true"/>
  <link rel="self" href="https://movida.bebanjo.net/api/deals/2"/>
  <link rel="rights" href="https://movida.bebanjo.net/api/deals/2/rights"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/deals/2/metadata"/>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensors/4"/>
  <link rel="granted_requirements" href="https://movida.bebanjo.net/api/deals/2/granted_requirements"/>
  <link rel="specific_platforms" href="https://movida.bebanjo.net/api/deals/2/specific_platforms"/>
</deal>
{
  "resource_type": "deal",
  "id": 2,
  "name": "Marvel deal 2013",
  "external_id": "Marvel2013",
  "right_type": "archive",
  "starts": "2014-06-10T00:00:00Z",
  "ends": "2015-07-01T00:00:00Z",
  "rights_updated_at": null,
  "utility_limit": null,
  "repeats": false,
  "minimum_exploitation": null,
  "maximum_exploitation": null,
  "exploitation_limits_context": null,
  "rerun_limit": null,
  "parity": null,
  "self_link": "https://movida.bebanjo.net/api/deals/2",
  "rights_link": "https://movida.bebanjo.net/api/deals/2/rights",
  "metadata_link": "https://movida.bebanjo.net/api/deals/2/metadata",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/4",
  "granted_requirements_link": "https://movida.bebanjo.net/api/deals/2/granted_requirements",
  "specific_platforms_link": "https://movida.bebanjo.net/api/deals/2/specific_platforms"
}

Updating a deal

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

$ cat payload.xml
$ cat payload.json
<?xml version='1.0' encoding='utf-8' ?>
<deal>
  <name>Marvel deal 2014</name>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensors/4"/>
</deal>
{
  "name": "Marvel deal 2014",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/4"
}

Note: The licensor URL must be of one licensor that already exists in the system, otherwise you will receive a message error reporting the licensor doesn’t exist. See how to create licensors in the licensor page.

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @payload.xml "https://movida.bebanjo.net/api/deals/2"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d @payload.json "https://movida.bebanjo.net/api/deals/2"

Mediagenix On-Demand will return the full XML/JSON of the deal just updated:

<?xml version='1.0' encoding='utf-8' ?>
<deal>
  <id type="integer">2</id>
  <name>Marvel deal 2014</name>
  <external-id>Marvel2013</external-id>
  <right-type>archive</right-type>
  <starts type="datetime">2014-06-10T00:00:00Z</starts>
  <ends type="datetime">2015-07-01T00:00:00Z</ends>
  <rights-updated-at type='datetime'>2014-06-01T04:47:09Z</rights-updated-at>
  <utility-limit nil="true"/>
  <repeats type="boolean">false</repeats>
  <minimum-exploitation nil="true"/>
  <maximum-exploitation nil="true"/>
  <exploitation-limits-context nil="true"/>
  <rerun-limit nil="true"/>
  <parity nil="true"/>
  <link rel="self" href="https://movida.bebanjo.net/api/deals/2"/>
  <link rel="rights" href="https://movida.bebanjo.net/api/deals/2/rights"/>
  <link rel="metadata" href="https://movida.bebanjo.net/api/deals/2/metadata"/>
  <link rel="licensor" href="https://movida.bebanjo.net/api/licensors/4"/>
  <link rel="granted_requirements" href="https://movida.bebanjo.net/api/deals/2/granted_requirements"/>
  <link rel="specific_platforms" href="https://movida.bebanjo.net/api/deals/2/specific_platforms"/>
</deal>
{
  "resource_type": "deal",
  "id": 2,
  "name": "Marvel deal 2014",
  "external_id": "Marvel2013",
  "right_type": "archive",
  "starts": "2014-06-10T00:00:00Z",
  "ends": "2015-07-01T00:00:00Z",
  "rights_updated_at": "2014-06-01T04:47:09Z",
  "utility_limit": null,
  "repeats": false,
  "minimum_exploitation": null,
  "maximum_exploitation": null,
  "exploitation_limits_context": null,
  "rerun_limit": null,
  "parity": null,
  "self_link": "https://movida.bebanjo.net/api/deals/2",
  "rights_link": "https://movida.bebanjo.net/api/deals/2/rights",
  "metadata_link": "https://movida.bebanjo.net/api/deals/2/metadata",
  "licensor_link": "https://movida.bebanjo.net/api/licensors/4",
  "granted_requirements_link": "https://movida.bebanjo.net/api/deals/2/granted_requirements",
  "specific_platforms_link": "https://movida.bebanjo.net/api/deals/2/specific_platforms"
}

Deleting a deal

Note: Deleting a deal won’t delete its series in cascade. Those series will keep existing but they won’t belong to any deal.

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

$ curl --digest -u robot_user:password -X DELETE "https://movida.bebanjo.net/api/deals/2"
$ curl --digest -u robot_user:password -H "Accept: application/json" -X DELETE "https://movida.bebanjo.net/api/deals/2"