参考 · 播放列表

查看播放列表

GET /v1/playlists/{uid}

按 uid 返回一个播放列表,包括按播放顺序排列的项目以及使用该播放列表的电视。

路径参数

名称类型说明
uidstring播放列表的 uid。

响应字段

uid string
播放列表标识符。
name string
播放列表名称。
organization object
播放列表所属的组织:uid 和 name。
total_time integer
播放列表的总时长,单位为秒。
total_time_is_approximate boolean
如果总时长为估算值,则为 true。
items array
播放列表中的项目,按播放顺序排列。
items[].position integer
项目在播放列表中的位置。
items[].type string
file 表示文件,entertainment 表示娱乐内容。也可能出现其他类型。
items[].uid string
文件或娱乐内容的标识符。
items[].display_time integer | null
项目设置的显示时长,单位为秒;如果未设置,则为 null。
items[].file object | null
文件信息,字段与“列出文件”相同;如果该项目不是文件,或用户无权查看其所属组织的文件,则为 null。
tvs array
使用该播放列表的电视(uid、name 和 organization)。仅显示用户可以查看的电视。

可能的错误

  • 404 not_found 端点不存在,或者项目不存在,或者项目属于该用户无权查看的组织。
  • 密钥错误和频率限制错误适用于所有端点。 查看所有错误
请求
curl "https://api.on-cloud.live/v1/playlists/e4da3b7fbbce2345d7772b0674a318d5" \
  -H "X-API-Key: $API_KEY"
<?php
$ch = curl_init('https://api.on-cloud.live/v1/playlists/e4da3b7fbbce2345d7772b0674a318d5');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('API_KEY')],
]);
$response = json_decode(curl_exec($ch), true);
const res = await fetch('https://api.on-cloud.live/v1/playlists/e4da3b7fbbce2345d7772b0674a318d5', {
  headers: { 'X-API-Key': process.env.API_KEY }
});
const { data } = await res.json();
响应200
{
  "data": {
    "uid": "e4da3b7fbbce2345d7772b0674a318d5",
    "name": "Lista principal",
    "organization": {
      "uid": "8f14e45fceea167a5a36dedd4bea2543",
      "name": "Loja Centro"
    },
    "total_time": 85,
    "total_time_is_approximate": true,
    "items": [
      {
        "position": 1,
        "type": "file",
        "uid": "a87ff679a2f3e71d9181a67b7542122c",
        "display_time": null,
        "file": {
          "uid": "a87ff679a2f3e71d9181a67b7542122c",
          "name": "Promoção de verão",
          "type": "video",
          "duration": 30,
          "archived": false,
          "organization": {
            "uid": "8f14e45fceea167a5a36dedd4bea2543",
            "name": "Loja Centro"
          }
        }
      },
      {
        "position": 2,
        "type": "entertainment",
        "uid": "noticias",
        "display_time": 15,
        "file": null
      },
      {
        "position": 3,
        "type": "file",
        "uid": "6512bd43d9caa6e02c990b0a82652dca",
        "display_time": 10,
        "file": {
          "uid": "6512bd43d9caa6e02c990b0a82652dca",
          "name": "Cardápio do dia",
          "type": "image",
          "duration": 10,
          "archived": false,
          "organization": {
            "uid": "8f14e45fceea167a5a36dedd4bea2543",
            "name": "Loja Centro"
          }
        }
      }
    ],
    "tvs": [
      {
        "uid": "c98cb8f9cc62887d1f6cf5693df9219c",
        "name": "Recepção",
        "organization": {
          "uid": "8f14e45fceea167a5a36dedd4bea2543",
          "name": "Loja Centro"
        }
      },
      {
        "uid": "45c48cce2e2d7fbdea1afc51c7c6ad26",
        "name": "Vitrine",
        "organization": {
          "uid": "8f14e45fceea167a5a36dedd4bea2543",
          "name": "Loja Centro"
        }
      }
    ]
  }
}
项目不存在或无权访问404
{
  "error": {
    "code": "not_found",
    "message": "Item not found or you do not have access to it."
  }
}