ข้อมูลอ้างอิง · ไฟล์
ดูข้อมูลไฟล์
GET
/v1/files/{uid}
แสดงไฟล์หนึ่งไฟล์ตาม uid พร้อมขนาด ความละเอียด URL ของไฟล์ต้นฉบับ และเพลย์ลิสต์ที่มีไฟล์นี้อยู่
พารามิเตอร์ในพาธ
| ชื่อ | ประเภท | คำอธิบาย |
|---|---|---|
uid | string | uid ของไฟล์ |
ฟิลด์ของการตอบกลับ
uidstring- ตัวระบุไฟล์
namestring- ชื่อไฟล์ในแผงควบคุม
typestring- ประเภทไฟล์ เช่น
imageหรือvideo durationinteger- ระยะเวลา หน่วยเป็นวินาที
archivedbooleantrueหากไฟล์ถูกเก็บถาวรorganizationobject- องค์กรของไฟล์:
uidและname sizeinteger- ขนาดของไฟล์ต้นฉบับ หน่วยเป็นไบต์
widthinteger- ความกว้างของไฟล์ต้นฉบับ หน่วยเป็นพิกเซล
heightinteger- ความสูงของไฟล์ต้นฉบับ หน่วยเป็นพิกเซล
aspect_ratiostring- อัตราส่วนระหว่างความกว้างและความสูง เช่น
1.78 urlstring- URL ของไฟล์ต้นฉบับ หรือข้อความว่างหากไม่มีให้ใช้
scheduledbooleantrueหากไฟล์มีการตั้งเวลาที่ใช้งานอยู่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."
}
}