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 applies to. If the relationship is empty, the right 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>

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>

Creating a specific platform for a right

To create a new specific platform, you just need to POST a proper XML specific platform representation to the specific platforms URL of the resource. That URL can be found in a link which rel attribute equals specific_platforms. The only information required to include in the payload is a link to the proper platform.

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

$ cat specific_platform.xml
<specific-platform>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/3"/>
</specific-platform>
$ curl -u robot_user:password --digest -H "Content-Type: application/xml" -X POST -d @specific_platform.xml "https://movida.bebanjo.net/api/rights/13/specific_platforms"

Movida will return the full XML of the specific platform just created:

<?xml version="1.0" encoding="UTF-8"?>
<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>

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 or right) nor the platform.

Last updated May 05th, 2017.