參考資料 · 檔案
查看檔案
GET
/v1/files/{uid}
按 uid 傳回一個檔案,包括其大小、解像度、原始檔案的網址,以及包含此檔案的播放清單。
路徑參數
| 名稱 | 類型 | 說明 |
|---|---|---|
uid | string | 檔案的 uid。 |
回應欄位
uidstring- 檔案識別碼。
namestring- 檔案在控制台中的名稱。
typestring- 檔案類型,例如
image或video。 durationinteger- 長度,以秒為單位。
archivedboolean- 如檔案已封存,則為
true。 organizationobject- 檔案所屬的公司:
uid及name。 sizeinteger- 原始檔案的大小,以位元組為單位。
widthinteger- 原始檔案的闊度,以像素為單位。
heightinteger- 原始檔案的高度,以像素為單位。
aspect_ratiostring- 闊度與高度的比例,例如
1.78。 urlstring- 原始檔案的網址;如無法提供,則為空白字串。
scheduledboolean- 如檔案有生效中的排程,則為
true。 playlistsarray- 包含此檔案的播放清單(
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."
}
}