AEM Screens stellt eine einfache RESTful-API bereit, die der Siren-Spezifikation entspricht. Sie ermöglicht die Navigation in der Inhaltsstruktur und das Senden von Befehlen an Geräte in der Umgebung.
Die API steht unter http://localhost:4502/api/screens.json zur Verfügung.
Die von den API-Aufrufen zurückgegebene JSON-Datei listet die Entitäten auf, die im Zusammenhang mit der aktuellen Ressource stehen. Über den aufgeführten Selbst-Link kann auf jede dieser Entitäten wieder als REST-Ressource zugegriffen werden.
Um beispielsweise auf die Bildschirme an unserem Demo-Flagship-Standort zuzugreifen, können Sie Folgendes aufrufen:
GET /api/screens/content/screens/we-retail/locations/demo/flagship.json HTTP/1.1
Host: http://localhost:4502
Oder mithilfe von cURL:
curl -u admin:admin http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship.json
Das Ergebnis sieht dann wie folgt aus:
{
"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
}
},
…
]
}
Und um dann auf den einzelnen Bildschirm zuzugreifen, können Sie Folgendes aufrufen:
GET /api/screens/content/screens/we-retail/locations/demo/flagship/single.json HTTP/1.1
Host: http://localhost:4502
Die von den API-Aufrufen zurückgegebene JSON-Datei kann eine Liste von Aktionen enthalten, die für die Ressource verfügbar sind.
Auf dem Bildschirm wird beispielsweise eine Aktion broadcast-command aufgeführt, die es erlaubt, einen Befehl an alle diesem Bildschirm zugeordneten Geräte zu senden.
GET /api/screens/content/screens/we-retail/locations/demo/flagship/single.json HTTP/1.1
Host: http://localhost:4502
Oder mithilfe von cURL:
curl -u admin:admin http://localhost:4502/api/screens/content/screens/we-retail/locations/demo/flagship/single.json
Ergebnis:
{
"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"
}
]
}
]
}
Um diese Aktion auszulösen, muss Folgendes aufgerufen werden:
POST /api/screens/content/screens/we-retail/locations/demo/flagship/single.json HTTP/1.1
Host: http://localhost:4502
:operation=broadcast-command&msg=reboot
Oder mithilfe von cURL:
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