Show Menu
TOPICS×

REST APIs

AEM Screens provides a simple RESTful API that follows the Siren specification. It allows to navigate the content structure and send commands to devices in the environment.
The API is accessible at http://localhost:4502/api/screens.json .

Executing Actions on the Resource

The JSON returned by the API calls can contain a list of actions that are available on the resource.
The display, for instance, lists a broadcast-command action that allows to send a command to all the devices assigned to that display.
GET /api/screens/content/screens/we-retail/locations/demo/flagship/single.json HTTP/1.1
Host: http://localhost:4502

Or using curl:
curl -u admin:admin http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship/single.json

Result:
{
  "class": [
    "aem-io/screens/display"
  ],
  "links": […],
  "properties": {…},
  "entities": […],
  "actions": [
    {
      "method": "POST",
      "name": "broadcast-command",
      "href": "/api/screens/content/screens/we-retail/locations/demo/flagship/single",
      "title": "",
      "fields": [
        {
          "name": ":operation",
          "type": "hidden",
          "value": "broadcast-command"
        },
        {
          "name": "command",
          "type": "text"
        },
        {
          "name": "command_payload",
          "optional": true,
          "type": "text"
        }
      ]
    }
  ]
}

To trigger this action one would call:
POST /api/screens/content/screens/we-retail/locations/demo/flagship/single.json HTTP/1.1
Host: http://localhost:4502

:operation=broadcast-command&command=reboot

Or using curl:
curl -u admin:admin -X POST -d ':operation=broadcast-command&command=reboot' http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship/single.json

Other resources will have different actions exposed. Some of them being:
  • Channels: boardcast-command , broadcast-command-with-ack , unassign
  • Displays: boardcast-command , broadcast-command-with-ack
  • Devices: boardcast-command , broadcast-command-with-ack