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.
The JSON returned by the API calls lists the entities related to the current resource. Following the listed self link, each of these entities is again accessible as a REST resource.
For instance, to access the displays in our demo flagship location, you can call:
GET /api/screens/content/screens/we-retail/locations/demo/flagship.json HTTP/1.1 Host: http://localhost:4502
curl -u admin:admin http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship.json
{ "class": [ "aem-io/screens/location" ], "links": [ { "rel": [ "self" ], "href": "http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship.json" }, { "rel": [ "parent" ], "href": "http://localhost:4502/api/screens/content/screens/we-retail/locations/demo.json" } ], "properties": {…}, "entities": [ { "class": [ "aem-io/screens/display" ], "links": [ { "rel": [ "self" ], "href": "http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship/single.json" } ], "rel": [ "child" ], "properties": { "title": "Single Screen Display", "height": 1440, "description": "Demo location of a single screen display.", "name": "single", "width": 2560, "idletimeout": 300, "layoutrows": 1, "layoutcols": 1 } }, … ] }
GET /api/screens/content/screens/we-retail/locations/demo/flagship/single.json HTTP/1.1 Host: http://localhost:4502
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
curl -u admin:admin http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship/single.json
{ "class": [ "aem-io/screens/display" ], "links": […], "properties": {…}, "entities": […], "actions": [ { "title": "", "name": "broadcast-command", "method": "POST", "href": "/api/screens/content/screens/we-retail/locations/demo/flagship/single", "fields": [ { "name": ":operation", "value": "broadcast-command", "type": "hidden" }, { "name": "msg", "type": "text" } ] } ] }
POST /api/screens/content/screens/we-retail/locations/demo/flagship/single.json HTTP/1.1 Host: http://localhost:4502 :operation=broadcast-command&msg=reboot
curl -u admin:admin -X POST -d ':operation=broadcast-command&msg=reboot' http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship/single.json