リファレンス · ファイル

ファイルを取得

GET /v1/files/{uid}

uidを指定して、ファイルを1件取得します。サイズ、解像度、元ファイルの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."
  }
}