Show Menu
主題×

REST API

AEM Screens提供遵循Siren規格的簡單REST風格 API 。 它允許導航內容結構,並向環境中的設備發送命令。
API可從http://localhost:4502/api/screens.json存

在資源上執行操作

API呼叫傳回的JSON可包含資源上可用動作的清單。
例如,顯示器列出了 broadcast-command (廣播命令)操作,該操作允許向分配給該顯示器的所有設備發送命令。
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