參考資料 · 電視
列出電視
GET
/v1/tvs
按字母順序列出用戶可查看電視的公司中已啟用的電視。
分頁回應:項目放在 data 內,分頁資料則放在 meta 內。 分頁及篩選
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
organization | string | 公司的 uid,用於只傳回該公司的項目(請參閱 /organizations)。 |
q | string | 名稱的部分文字,最多 100 個字元。 |
page | integer | 頁數,由 1 開始。預設值:1。 |
per_page | integer | 每頁項目數目,由 1 至 100。預設值:50。 |
每個項目的欄位
uidstring- 電視識別碼,與控制台使用的相同。
namestring- 電視名稱。
descriptionstring- 電視描述(可能留空)。
organizationobject- 電視所屬的公司:
uid及name。 playlistobject | null- 電視的播放清單(
uid及name);如沒有,則為null。 statusstringonline、alert或offline,詳見下文說明。last_seen_atstring | null- 電視最近一次與平台通訊的時間;如從未連線,則為
null。 activated_atstring | null- 電視的啟用時間。
app_versionstring- 電視上安裝的應用程式版本。
osstring- 電視的作業系統,例如
android。 deviceobject- 裝置品牌(
brand)及型號(model),只在電視有提供時顯示。 timezonestring | null- 電視的時區,例如
America/Sao_Paulo,或null。
狀態的計算方式
online最近 3 分鐘內有通訊,正在播放alert最近一次通訊在 3 至 9 分鐘前,或電視仍在啟動中offline10 分鐘或以上沒有通訊,或從未連線
規則與控制台的狀態顏色相同。
可能出現的錯誤
- 400
invalid_parameter某個參數的值無效,例如per_page超出上限。 - 404
organization_not_found所提供的organization並非該用戶可查看此類項目的公司。 - 金鑰錯誤及次數限制錯誤適用於所有端點。 查看所有錯誤
請求
curl "https://api.on-cloud.live/v1/tvs?per_page=2" \
-H "X-API-Key: $API_KEY"<?php
$ch = curl_init('https://api.on-cloud.live/v1/tvs?per_page=2');
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/tvs?per_page=2', {
headers: { 'X-API-Key': process.env.API_KEY }
});
const { data, meta } = await res.json();回應200
{
"data": [
{
"uid": "d3d9446802a44259755d38e6d163e820",
"name": "Caixa 2",
"description": "",
"organization": {
"uid": "1679091c5a880faf6fb5e6087eb1b2dc",
"name": "Loja Shopping Norte"
},
"playlist": null,
"status": "offline",
"last_seen_at": "2026-11-01T18:04:51-03:00",
"activated_at": "2025-03-12T09:41:05-03:00",
"app_version": "3.12.83",
"os": "android",
"device": {
"brand": "Philco",
"model": "PTV32G70"
},
"timezone": "America/Sao_Paulo"
},
{
"uid": "c98cb8f9cc62887d1f6cf5693df9219c",
"name": "Recepção",
"description": "TV da entrada",
"organization": {
"uid": "8f14e45fceea167a5a36dedd4bea2543",
"name": "Loja Centro"
},
"playlist": {
"uid": "e4da3b7fbbce2345d7772b0674a318d5",
"name": "Lista principal"
},
"status": "online",
"last_seen_at": "2026-11-03T14:32:10-03:00",
"activated_at": "2025-03-12T09:41:05-03:00",
"app_version": "3.12.84",
"os": "android",
"device": {
"brand": "TCL",
"model": "43P635"
},
"timezone": "America/Sao_Paulo"
}
],
"meta": {
"page": 1,
"per_page": 2,
"total": 3,
"total_pages": 2
}
}