Skip to content

Developers

How can we help you?

← Go back

Enumeration

Note: This resource links can be expanded using the expand option.

The enumeration resource describes reusable configuration of an account.

A enumeration looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<enumeration>
  <id type="integer">879</id>
  <name>Mediagenix On-Demand:Platform Configuration</name>
  <link rel="self" href="https://movida.bebanjo.net/api/enumerations/879"/>
  <link rel="entries" href="https://movida.bebanjo.net/api/enumerations/879/entries"/>
  <link rel="mappings" href="https://movida.bebanjo.net/api/enumerations/879/mappings"/>
</enumeration>
{
  "resource_type": "enumeration",
  "id": 879,
  "name": "Mediagenix On-Demand:Platform Configuration",
  "self_link": "https://movida.bebanjo.net/api/enumerations/879",
  "entries_link": "https://movida.bebanjo.net/api/enumerations/879/entries",
  "mappings_link": "https://movida.bebanjo.net/api/enumerations/879/mappings"
}

Note: currently enumerations cannot be updated/destroyed through the API. Please, contact your Technical Account Manager in order to define the list of enumerations suitable for your company.

Valid attributes

  • name (required): Name of the enumeration.
  • entries (optional): Each of the entries that describes the enumeration.
  • mappings (optional): Each of the mappings associated to that enumeration.

Get a list of all enumerations in the current account

In the root resource, just do a GET to the URL in the enumerations link:

<?xml version='1.0' encoding='utf-8' ?>
<movida>
  ...
  <link rel="enumerations" href="https://movida.bebanjo.net/api/enumerations"/>
  ...
</movida>
{
  "resource_type": "movida",
  // ...
  "enumerations_link": "https://movida.bebanjo.net/api/enumerations"
  // ...
}
$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/enumerations
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/enumerations

And:

<?xml version="1.0" encoding="UTF-8"?>
<enumerations type="array">
  <total-entries>66</total-entries>
  <link rel="next" href="https://movida.bebanjo.net/api/enumerations?page=2"/>
  <enumeration>
    <id type="integer">879</id>
    <name>Mediagenix On-Demand:Platform Configuration</name>
    <link rel="self" href="https://movida.bebanjo.net/api/enumerations/879"/>
    <link rel="entries" href="https://movida.bebanjo.net/api/enumerations/879/entries"/>
    <link rel="mappings" href="https://movida.bebanjo.net/api/enumerations/879/mappings"/>
  </enumeration>
  <enumeration>
    <id type="integer">923</id>
    <name>Source Origin</name>
    <link rel="self" href="https://movida.bebanjo.net/api/enumerations/923"/>
    <link rel="entries" href="https://movida.bebanjo.net/api/enumerations/923/entries"/>
    <link rel="mappings" href="https://movida.bebanjo.net/api/enumerations/923/mappings"/>
  </enumeration>
  <!-- ... -->
</enumerations>
{
  "total_entries": 66,
  "next_link": "https://movida.bebanjo.net/api/enumerations?page=2",
  "entries": [
    {
      "resource_type": "enumeration",
      "id": 879,
      "name": "Mediagenix On-Demand:Platform Configuration",
      "self_link": "https://movida.bebanjo.net/api/enumerations/879",
      "entries_link": "https://movida.bebanjo.net/api/enumerations/879/entries",
      "mappings_link": "https://movida.bebanjo.net/api/enumerations/879/mappings"
    },
    {
      "resource_type": "enumeration",
      "id": 923,
      "name": "Source Origin",
      "self_link": "https://movida.bebanjo.net/api/enumerations/923",
      "entries_link": "https://movida.bebanjo.net/api/enumerations/923/entries",
      "mappings_link": "https://movida.bebanjo.net/api/enumerations/923/mappings"
    },
    // ...
  ]
}

Note: This is a paginated resource. By default, only 50 enumerations 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.

Valid attributes

You can filter the list of enumerations returned using the following attributes:

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

Get a specific enumeration

Just do a GET to the URL in the enumeration self link

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/enumerations/879
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/enumerations/879

And:

<?xml version='1.0' encoding='utf-8' ?>
<enumeration>
  <id type="integer">879</id>
  <name>Mediagenix On-Demand:Platform Configuration</name>
  <link rel="self" href="https://movida.bebanjo.net/api/enumerations/879"/>
  <link rel="entries" href="https://movida.bebanjo.net/api/enumerations/879/entries"/>
  <link rel="mappings" href="https://movida.bebanjo.net/api/enumerations/879/mappings"/>
</enumeration>
{
  "resource_type": "enumeration",
  "id": 879,
  "name": "Mediagenix On-Demand:Platform Configuration",
  "self_link": "https://movida.bebanjo.net/api/enumerations/879",
  "entries_link": "https://movida.bebanjo.net/api/enumerations/879/entries",
  "mappings_link": "https://movida.bebanjo.net/api/enumerations/879/mappings"
}

Remember you can use the expand me some nodes trick if you want to, for instance, find out what are the entries and mappings of a particular enumeration.

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/enumerations/879?expand=entries,mappings,mapping_entries
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/enumerations/879?expand=entries,mappings,mapping_entries

This would expand the rel="entries", the rel="mappings" links inside the enumeration, and the rel="mapping_entries" link inside each entry yielding something like:

<?xml version='1.0' encoding='utf-8' ?>
<enumeration>
  <id type="integer">879</id>
  <name>Mediagenix On-Demand:Platform Configuration</name>
  <link rel="self" href="https://movida.bebanjo.net/api/enumerations/879"/>
  <link rel="entries" href="https://movida.bebanjo.net/api/enumerations/879/entries">
    <entries type="array">
      <entry>
        <id type="integer">66475</id>
        <value>France > Bouygues > Boing > Catch Up</value>
        <description>France > Bouygues > Boing > Catch Up</description>
        <link rel="self" href="https://movida.bebanjo.net/api/entries/66475"/>
        <link rel="enumeration" href="https://movida.bebanjo.net/api/enumerations/879"/>
        <link rel="mapping_entries" href="https://movida.bebanjo.net/api/entries/66475/mapping_entries">
          <mapping-entries type="array">
            <mapping-entry>
              <id type="integer">34</id>
              <value>Bouygues</value>
              <link rel="entry" href="https://movida.bebanjo.net/api/entries/66475"/>
              <link rel="mapping" href="https://movida.bebanjo.net/api/mappings/7"/>
            </mapping-entry>
            <mapping-entry>
              <id type="integer">35</id>
              <value>Boing</value>
              <link rel="entry" href="https://movida.bebanjo.net/api/entries/66475"/>
              <link rel="mapping" href="https://movida.bebanjo.net/api/mappings/8"/>
            </mapping-entry>
            <mapping-entry>
              <id type="integer">36</id>
              <value>Catch Up</value>
              <link rel="entry" href="https://movida.bebanjo.net/api/entries/66475"/>
              <link rel="mapping" href="https://movida.bebanjo.net/api/mappings/9"/>
            </mapping-entry>
            <mapping-entry>
              <id type="integer">1717</id>
              <value nil="true"/>
              <link rel="entry" href="https://movida.bebanjo.net/api/entries/66475"/>
              <link rel="mapping" href="https://movida.bebanjo.net/api/mappings/24"/>
            </mapping-entry>
          </mapping-entries>
        </link>
      </entry>
      <!-- ... -->
    </entries>
  </link>
  <link rel="mappings" href="https://movida.bebanjo.net/api/enumerations/879/mappings">
    <mappings type="array">
      <mapping>
        <id type="integer">9</id>
        <name>Business Model</name>
        <link rel="self" href="https://movida.bebanjo.net/api/mappings/9"/>
        <link rel="enumeration" href="https://movida.bebanjo.net/api/enumerations/879"/>
      </mapping>
      <mapping>
        <id type="integer">8</id>
        <name>Channel Brand</name>
        <link rel="self" href="https://movida.bebanjo.net/api/mappings/8"/>
        <link rel="enumeration" href="https://movida.bebanjo.net/api/enumerations/879"/>
      </mapping>
      <!-- ... -->
    </mappings>
  </link>
</enumeration>
{
  "resource_type": "enumeration",
  "id": 879,
  "name": "Mediagenix On-Demand:Platform Configuration",
  "self_link": "https://movida.bebanjo.net/api/enumerations/879",
  "entries_link": "https://movida.bebanjo.net/api/enumerations/879/entries",
  "entries": {
    "entries": [
      {
        "resource_type": "entry",
        "id": 66475,
        "value": "France > Bouygues > Boing > Catch Up",
        "description": "France > Bouygues > Boing > Catch Up",
        "self_link": "https://movida.bebanjo.net/api/entries/66475",
        "enumeration_link": "https://movida.bebanjo.net/api/enumerations/879",
        "mapping_entries_link": "https://movida.bebanjo.net/api/entries/66475/mapping_entries",
        "mapping_entries": {
          "entries": [
            {
              "resource_type": "mapping_entry",
              "id": 34,
              "value": "Bouygues",
              "entry_link": "https://movida.bebanjo.net/api/entries/66475",
              "mapping_link": "https://movida.bebanjo.net/api/mappings/7"
            },
            {
              "resource_type": "mapping_entry",
              "id": 35,
              "value": "Boing",
              "entry_link": "https://movida.bebanjo.net/api/entries/66475",
              "mapping_link": "https://movida.bebanjo.net/api/mappings/8"
            },
            {
              "resource_type": "mapping_entry",
              "id": 36,
              "value": "Catch Up",
              "entry_link": "https://movida.bebanjo.net/api/entries/66475",
              "mapping_link": "https://movida.bebanjo.net/api/mappings/9"
            },
            {
              "resource_type": "mapping_entry",
              "id": 1717,
              "value": null,
              "entry_link": "https://movida.bebanjo.net/api/entries/66475",
              "mapping_link": "https://movida.bebanjo.net/api/mappings/24"
            }
          ]
        }
      },
      // ...
    ]
  },
  "mappings_link": "https://movida.bebanjo.net/api/enumerations/879/mappings",
  "mappings": {
    "entries": [
      {
        "resource_type": "mapping",
        "id": 9,
        "name": "Business Model",
        "self_link": "https://movida.bebanjo.net/api/mappings/9",
        "enumeration_link": "https://movida.bebanjo.net/api/enumerations/879"
      },
      {
        "resource_type": "mapping",
        "id": 8,
        "name": "Channel Brand",
        "self_link": "https://movida.bebanjo.net/api/mappings/8",
        "enumeration_link": "https://movida.bebanjo.net/api/enumerations/879"
      },
      // ...
    ]
  }
}

Create a new enumeration

To create enumerations, you just need to POST proper XML/JSON enumeration representation to the enumerations link.

For example, this POST would create an enumeration (we will use curl’s @ option, which reads data to be posted from a file):

$ cat enumeration.xml
$ cat enumeration.json
<enumeration>
  <name>Resolution</name>
</enumeration>
{
    "resource_type": "enumeration",
    "name": "Resolution"
}
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -H "Accept: application/xml" -X POST -d @enumeration.xml "https://movida.bebanjo.net/api/enumerations"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @enumeration.json "https://movida.bebanjo.net/api/enumerations"

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

<?xml version="1.0" encoding="UTF-8"?>
<enumeration>
    <id type="integer">880</id>
    <name>Resolution</name>
    <link rel="self" href="https://movida.bebanjo.net/api/enumerations/880"/>
    <link rel="entries" href="https://movida.bebanjo.net/api/enumerations/880/entries"/>
    <link rel="mappings" href="https://movida.bebanjo.net/api/enumerations/880/mappings"/>
</enumeration>
{
    "resource_type": "enumeration",
    "id": 880,
    "name": "Resolution",
    "self_link": "https://movida.bebanjo.net/api/enumerations/880",
    "entries_link": "https://movida.bebanjo.net/api/enumerations/880/entries",
    "mappings_link": "https://movida.bebanjo.net/api/enumerations/880/mappings"
}