リファレンス · ファイル
ファイルを取得
GET
/v1/files/{uid}
uidを指定して、ファイルを1件取得します。サイズ、解像度、元ファイルのURL、そのファイルを含むプレイリストも返されます。
パスパラメーター
| 名前 | 型 | 説明 |
|---|---|---|
uid | string | ファイルのuid。 |
レスポンスのフィールド
uidstring- ファイルの識別子。
namestring- コントロールパネルでのファイル名。
typestring- ファイルの種類(
image、videoなど)。 durationinteger- 再生時間(秒)。
archivedboolean- ファイルがアーカイブ済みの場合は
true。 organizationobject- ファイルが属する組織:
uidとname。 sizeinteger- 元ファイルのサイズ(バイト)。
widthinteger- 元ファイルの幅(ピクセル)。
heightinteger- 元ファイルの高さ(ピクセル)。
aspect_ratiostring- 幅と高さの比率(
1.78など)。 urlstring- 元ファイルのURL。利用できない場合は空文字列。
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."
}
}