Referència · Fitxers
Veure un fitxer
GET
/v1/files/{uid}
Retorna un fitxer a partir del seu uid, amb la mida, la resolució, l'URL del fitxer original i les llistes de reproducció en què figura.
Paràmetre de ruta
| Nom | Tipus | Descripció |
|---|---|---|
uid | string | uid del fitxer. |
Camps de la resposta
uidstring- Identificador del fitxer.
namestring- Nom del fitxer al tauler.
typestring- Tipus de fitxer, com ara
imageovideo. durationinteger- Durada, en segons.
archivedbooleantruesi el fitxer està arxivat.organizationobject- Organització del fitxer:
uidiname. sizeinteger- Mida del fitxer original, en bytes.
widthinteger- Amplada del fitxer original, en píxels.
heightinteger- Alçada del fitxer original, en píxels.
aspect_ratiostring- Relació entre l'amplada i l'alçada, com ara
1.78. urlstring- URL del fitxer original, o un text buit si no està disponible.
scheduledbooleantruesi el fitxer té una programació activa.playlistsarray- Llistes de reproducció en què figura el fitxer (
uid,nameiorganization). Només hi apareixen les llistes que l'usuari pot veure.
Errors possibles
- 404
not_foundL'endpoint no existeix, o bé l'element no existeix o pertany a una organització que l'usuari no pot veure. - Els errors de clau i de límit s'apliquen a tots els endpoints. Veure tots els errors
Sol·licitud
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();Resposta200
{
"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"
}
}
]
}
}Element inexistent o sense accés404
{
"error": {
"code": "not_found",
"message": "Item not found or you do not have access to it."
}
}