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

Target platform

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

The Target Platform resource is used to specify the output platforms for which a given resource (normally and Image or a Rendition) is good for.

For instance, you could have one image associated to a title that is valid for multiple platforms and some other images which are valid for other platforms.

We’re going to explain how to manipulate target platforms associated to images. But the same can be applied for other resources, like renditions.

In Movida land, a target platform looks like:

<target-platform>
  <link rel="self" href="https://movida.bebanjo.net/api/target_platforms/1"/>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/1"/>
</target-platform>

Get a List of all target platforms of a resource

Target platforms are accessed via its Content Resource, for example, Image Resource. Refer to the corresponding resource page, i.e. Movida Resource: Image page to find out how to access an Image. Inside an Image, one of the related link nodes is the target_platforms node, identified by the rel attribute. Like here:

<?xml version='1.0' encoding='utf-8' ?>
<image>
  <!-- ... -->
  <link href="https://movida.bebanjo.net/api/images/1/target_platforms" rel="target_platforms"/>
  <!-- ... -->
</image>

If we follow that link we can fetch the list of all target platforms for that image.

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/images/1/target_platforms
<?xml version="1.0" encoding="UTF-8"?>
<target-platforms type="array">
  <target-platform>
    <link rel="self" href="https://movida.bebanjo.net/api/target_platforms/5"/>
    <link rel="platform" href="https://movida.bebanjo.net/api/platforms/1"/>
  </target-platform>
</target-platforms>

Creating target platform for a resource

To create a new target platform, you just need to POST a proper XML target platform representation to the target platforms URL of the resource. That URL can be found in a link which ‘rel’ attribute equals ‘target_platforms’. The only attribute is the platform .

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

$ cat target_platform.xml
<?xml version="1.0" encoding="UTF-8"?>
<target_platform>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/1"/>
</target_platform>
$ curl -u robot_user:password --digest -H "Content-Type: application/xml" -X POST -d @target_platform.xml "https://movida.bebanjo.net/api/images/1/target_platforms"

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

<?xml version="1.0" encoding="UTF-8"?>
<target-platform>
  <link rel="self" href="https://movida.bebanjo.net/api/target_platforms/1"/>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/1"/>
</target-platform>

Updating a target platform

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

$ cat target_platform.xml
<?xml version="1.0" encoding="UTF-8"?>
<target_platform>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/2"/>
</target_platform>

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

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

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

<?xml version="1.0" encoding="UTF-8"?>
<target-platform>
  <link rel="self" href="https://movida.bebanjo.net/api/target_platforms/1"/>
  <link rel="platform" href="https://movida.bebanjo.net/api/platforms/2"/>
</target-platform>

Delete a target platform

The following example shows how to destroy a particular target 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/target_platforms/1"

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

Deleting a target platform doesn’t delete the targeted content nor the platform.

Last updated May 05th, 2017.