ข้อมูลอ้างอิง · ไฟล์

ดูข้อมูลไฟล์

GET /v1/files/{uid}

แสดงไฟล์หนึ่งไฟล์ตาม uid พร้อมขนาด ความละเอียด URL ของไฟล์ต้นฉบับ และเพลย์ลิสต์ที่มีไฟล์นี้อยู่

พารามิเตอร์ในพาธ

ชื่อประเภทคำอธิบาย
uidstringuid ของไฟล์

ฟิลด์ของการตอบกลับ

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."
  }
}