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

Specific platform

The specific platform resource is used to specify the specific platforms right/rule applies to. If the relationship is empty, the right/rule applies to all the platforms of the company.

In Movida, a specific platform will look like this:

<specific-platform>
  <id type="integer">1</id>
  <link rel="self" href="https://movida.bebanjo.net/api/specific_platforms/1"/>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/3"/>
</specific-platform>

Create a specific platform

As our introduction to REST APIs page suggests, you can create a specific platform issuing a POST request to each right/rule URI:

cat specific_platform.xml
<specific-platform>
  <link rel="platform" href="http://movida.bebanjo.net/api/platforms/3"/>
</specific-platform>

For rules:

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @specific_platform.xml "https://movida.bebanjo.net/api/rules/13/specific_platforms"

For rights:

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @specific_platform.xml "https://movida.bebanjo.net/api/rights/13/specific_platforms"

As always Movida will return the full XML of the specific_platform just updated:

<?xml version="1.0" encoding="UTF-8"?>
<specific-platform>
  <id type="integer">1</id>
  <link rel="self" href="https://movida.bebanjo.net/api/specific_platforms/1"/>
  <link rel="platform" href="http://movida.bebanjo.net/api/platforms/3"/>
</specific-platform>

Listing all specific platforms of a right

Specific platforms are accessed via the right they belong to. Refer to the corresponding resource page, i.e right resource page to find out how to access a right.

Inside a right, one of the related link nodes is the specific_platforms node, identified by the rel attribute.

Example for a right:

<?xml version='1.0' encoding='utf-8' ?>
<right>
  <!-- ... -->
  <link rel="specific_platforms" href="https://movida.bebanjo.net/api/rights/13/specific_platforms"/>
  <!-- ... -->
</right>

If we follow that link we can fetch the list of all specific platforms for that right.

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/rights/13/specific_platforms
<specific_platforms type="array">
  <specific_platform>
    <id type="integer">10</id>
    <link rel="self" href="https://movida.bebanjo.net/api/specific_platforms/10"/>
    <link rel="platform" href="https://movida.bebanjo.net/api/platforms/3"/>
  </specific_platform>
  <specific_platform>
    <id type="integer">11</id>
    <link rel="self" href="https://movida.bebanjo.net/api/specific_platforms/11"/>
    <link rel="platform" href="https://movida.bebanjo.net/api/platforms/2"/>
  </specific_platform>
</specific_platforms>

Listing all specific platforms of a rule

Specific platforms are accessed via the rule they belong to. Refer to the corresponding resource page, i.e rule resource page to find out how to access a rule.

Inside a rule, one of the related link nodes is the specific_platforms node, identified by the rel attribute.

Example for a rule:

<?xml version='1.0' encoding='utf-8' ?>
<rule>
  <!-- ... -->
  <link rel="specific_platforms" href="http://movida.bebanjo.net/api/rules/13/specific_platforms"/>
  <!-- ... -->
</rule>

If we follow that link we can fetch the list of all specific platforms for that rule.

$ curl --digest -u robot_user:password http://movida.bebanjo.net/api/rules/13/specific_platforms
<specific_platforms type="array">
  <specific_platform>
    <id type="integer">10</id>
    <link rel="self" href="https://movida.bebanjo.net/api/specific_platforms/10"/>
    <link rel="platform" href="http://movida.bebanjo.net/api/platforms/3"/>
  </specific_platform>
  <specific_platform>
    <id type="integer">11</id>
    <link rel="self" href="https://movida.bebanjo.net/api/specific_platforms/11"/>
    <link rel="platform" href="http://movida.bebanjo.net/api/platforms/2"/>
  </specific_platform>
</specific_platforms>

Updating a specific platform

You can update specific platforms using a PUT request to the URL of a given specific platform, as the following example illustrates.

$ cat specific_platform.xml
<specific-platform>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/4"/>
</specific-platform>

Now we send the XML as the body of a PUT request to the specific platform’s URL

$ curl -u robot_user:password --digest -H "Content-Type: application/xml" -X PUT -d @specific_platform.xml "https://movida.bebanjo.net/api/specific_platforms/10"

The PUT request would return the updated XML of the specific platform:

<specific-platform>
  <id type="integer">10</id>
  <link rel="self" href="https://movida.bebanjo.net/api/specific_platform/10"/>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/4"/>
</specific-platform>

Deleting a specific platform

The following example shows how to destroy a particular specific platform. Only a DELETE HTTP request to its URL is required:

$ curl -u robot_user:password --digest -H "Content-Type: application/xml" -X DELETE "https://movida.bebanjo.net/api/specific_platforms/10"

The DELETE request doesn’t return anything, as that specific platform now is gone.

Deleting a specific platforms doesn’t delete the parent (deal, right or rule) nor the platform.

Last updated July 07th, 2017.