参考 · 电视

列出电视

GET /v1/tvs

按字母顺序列出用户有权查看电视的组织中已激活的电视。

分页响应:项目位于 data 中,分页信息位于 meta 中。 分页和筛选

参数

名称类型说明
organizationstring组织的 uid,用于只返回该组织的项目(参见 /organizations)。
qstring名称中的部分文字,最多 100 个字符。
pageinteger页码,从 1 开始。默认值:1。
per_pageinteger每页项目数,范围为 1 到 100。默认值:50。

每个项目的字段

uid string
电视标识符,与控制面板中使用的相同。
name string
电视名称。
description string
电视描述(可能为空)。
organization object
电视所属的组织:uid 和 name。
playlist object | null
电视的播放列表(uid 和 name);如果没有,则为 null。
status string
online、alert 或 offline,说明见下文。
last_seen_at string | null
电视最近一次与平台通信的时间;如果从未连接过,则为 null。
activated_at string | null
电视的激活时间。
app_version string
电视上安装的应用版本。
os string
电视的操作系统,例如 android。
device object
设备品牌(brand)和型号(model),在电视上报时提供。
timezone string | null
电视的时区,例如 America/Sao_Paulo,或 null。

状态的计算方式

  • online 3 分钟内有通信,正在播放
  • alert 最近一次通信在 3 到 9 分钟前,或电视仍在启动
  • offline 10 分钟或更长时间无通信,或从未连接过

与控制面板中状态颜色的规则相同。

可能的错误

  • 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
  }
}