Show Menu
主题×

REST API

AEM Screens提供了一个遵循Siren规范的简单RESTful API siren 。 它允许导航内容结构并将命令发送到环境中的设备。
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