Referentie · Bestanden

Een bestand opvragen

GET /v1/files/{uid}

Geeft een bestand op basis van de uid, met de grootte, de resolutie, de URL van het originele bestand en de playlists waarin het staat.

Padparameter

NaamTypeBeschrijving
uidstringuid van het bestand.

Velden van het antwoord

uid string
ID van het bestand.
name string
Naam van het bestand in het beheerpaneel.
type string
Bestandstype, zoals image of video.
duration integer
Duur, in seconden.
archived boolean
true als het bestand gearchiveerd is.
organization object
Organisatie van het bestand: uid en name.
size integer
Grootte van het originele bestand, in bytes.
width integer
Breedte van het originele bestand, in pixels.
height integer
Hoogte van het originele bestand, in pixels.
aspect_ratio string
Verhouding tussen breedte en hoogte, zoals 1.78.
url string
URL van het originele bestand, of een lege string als die niet beschikbaar is.
scheduled boolean
true als het bestand een actieve planning heeft.
playlists array
Playlists waarin het bestand staat (uid, name en organization). Alleen playlists die de gebruiker kan zien, worden getoond.

Mogelijke fouten

  • 404 not_found Het endpoint bestaat niet, of het item bestaat niet of hoort bij een organisatie die de gebruiker niet kan zien.
  • Fouten rond de sleutel en de verzoeklimiet gelden voor alle endpoints. Alle fouten bekijken
Verzoek
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();
Antwoord200
{
  "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"
        }
      }
    ]
  }
}
Item bestaat niet of geen toegang404
{
  "error": {
    "code": "not_found",
    "message": "Item not found or you do not have access to it."
  }
}