参考 · 文件

查看文件

GET /v1/files/{uid}

按 uid 返回一个文件,包括其大小、分辨率、原始文件的 URL 以及包含该文件的播放列表。

路径参数

名称类型说明
uidstring文件的 uid。

响应字段

uid string
文件标识符。
name string
文件在控制面板中的名称。
type string
文件类型,例如 image 或 video。
duration integer
时长,单位为秒。
archived boolean
如果文件已归档,则为 true。
organization object
文件所属的组织:uid 和 name。
size integer
原始文件的大小,单位为字节。
width integer
原始文件的宽度,单位为像素。
height integer
原始文件的高度,单位为像素。
aspect_ratio string
宽高比,例如 1.78。
url string
原始文件的 URL;如果不可用,则为空字符串。
scheduled boolean
如果文件有生效中的排期,则为 true。
playlists array
包含该文件的播放列表(uid、name 和 organization)。仅显示用户可以查看的播放列表。

可能的错误

  • 404 not_found 端点不存在,或者项目不存在,或者项目属于该用户无权查看的组织。
  • 密钥错误和频率限制错误适用于所有端点。 查看所有错误
请求
curl "https://api.on-cloud.live/v1/files/a87ff679a2f3e71d9181a67b7542122c" \
  -H "X-API-Key: $API_KEY"
<?php
$ch = curl_init('https://api.on-cloud.live/v1/files/a87ff679a2f3e71d9181a67b7542122c');
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/a87ff679a2f3e71d9181a67b7542122c', {
  headers: { 'X-API-Key': process.env.API_KEY }
});
const { data } = await res.json();
响应200
{
  "data": {
    "uid": "a87ff679a2f3e71d9181a67b7542122c",
    "name": "Promoção de verão",
    "type": "video",
    "duration": 30,
    "archived": false,
    "organization": {
      "uid": "8f14e45fceea167a5a36dedd4bea2543",
      "name": "Loja Centro"
    },
    "size": 18734520,
    "width": 1920,
    "height": 1080,
    "aspect_ratio": "1.78",
    "url": "https://oncloud.bunny.files.on-cloud.live/files/a87ff679a2f3e71d9181a67b7542122c-1.mp4",
    "scheduled": true,
    "playlists": [
      {
        "uid": "e4da3b7fbbce2345d7772b0674a318d5",
        "name": "Lista principal",
        "organization": {
          "uid": "8f14e45fceea167a5a36dedd4bea2543",
          "name": "Loja Centro"
        }
      }
    ]
  }
}
项目不存在或无权访问404
{
  "error": {
    "code": "not_found",
    "message": "Item not found or you do not have access to it."
  }
}