参考 · 文件

列出文件

GET /v1/files

按从新到旧的顺序列出用户有权查看文件的组织中的文件。

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

参数

名称类型说明
organizationstring组织的 uid,用于只返回该组织的项目(参见 /organizations)。
qstring名称中的部分文字,最多 100 个字符。
typestring文件类型,例如 image 或 video。
archivedinteger1 表示仅返回已归档的文件,0 表示仅返回未归档的文件。不传此参数时返回全部文件。
pageinteger页码,从 1 开始。默认值:1。
per_pageinteger每页项目数,范围为 1 到 100。默认值:50。

每个项目的字段

uid string
文件标识符。
name string
文件在控制面板中的名称。
type string
文件类型,例如 image 或 video。
duration integer
时长,单位为秒。
archived boolean
如果文件已归档,则为 true。
organization object
文件所属的组织:uid 和 name。

可能的错误

  • 400 invalid_parameter 某个参数的值无效,例如 per_page 超过最大值。
  • 404 organization_not_found 传入的 organization 不是该用户可以查看此类项目的组织。
  • 密钥错误和频率限制错误适用于所有端点。 查看所有错误
请求
curl "https://api.on-cloud.live/v1/files?per_page=2" \
  -H "X-API-Key: $API_KEY"
<?php
$ch = curl_init('https://api.on-cloud.live/v1/files?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/files?per_page=2', {
  headers: { 'X-API-Key': process.env.API_KEY }
});
const { data, meta } = await res.json();
响应200
{
  "data": [
    {
      "uid": "c20ad4d76fe97759aa27a0c99bff6710",
      "name": "Horário de funcionamento",
      "type": "image",
      "duration": 8,
      "archived": false,
      "organization": {
        "uid": "1679091c5a880faf6fb5e6087eb1b2dc",
        "name": "Loja Shopping Norte"
      }
    },
    {
      "uid": "6512bd43d9caa6e02c990b0a82652dca",
      "name": "Cardápio do dia",
      "type": "image",
      "duration": 10,
      "archived": false,
      "organization": {
        "uid": "8f14e45fceea167a5a36dedd4bea2543",
        "name": "Loja Centro"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 2,
    "total": 3,
    "total_pages": 2
  }
}