參考資料 · 播放清單

查看播放清單

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."
  }
}