Referència · Fitxers

Llistar fitxers

GET /v1/files

Retorna els fitxers de les organitzacions en què l'usuari pot veure fitxers, del més recent al més antic.

Resposta paginada: els elements es retornen a data i la informació de la pàgina, a meta. Paginació i filtres

Paràmetres

NomTipusDescripció
organizationstringuid d'una organització, per obtenir només els seus elements (vegeu /organizations).
qstringPart del nom, fins a 100 caràcters.
typestringTipus de fitxer, com ara image o video.
archivedinteger1 per obtenir només els arxivats o 0 per obtenir només els no arxivats. Sense aquest paràmetre, es retornen tots.
pageintegerPàgina, a partir d'1. Valor per defecte: 1.
per_pageintegerElements per pàgina, d'1 a 100. Valor per defecte: 50.

Camps de cada element

uid string
Identificador del fitxer.
name string
Nom del fitxer al tauler.
type string
Tipus de fitxer, com ara image o video.
duration integer
Durada, en segons.
archived boolean
true si el fitxer està arxivat.
organization object
Organització del fitxer: uid i name.

Errors possibles

  • 400 invalid_parameter Un paràmetre té un valor no vàlid, com ara per_page per sobre del màxim.
  • 404 organization_not_found El valor d'organization indicat no correspon a cap organització en què l'usuari pugui veure aquest tipus d'element.
  • 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?per_page=2" \
  -H "X-API-Key: $API_KEY"
<?php
$ch = curl_init('https://api.on-cloud.live/v1/files?per_page=2');
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?per_page=2', {
  headers: { 'X-API-Key': process.env.API_KEY }
});
const { data, meta } = await res.json();
Resposta200
{
  "data": [
    {
      "uid": "c20ad4d76fe97759aa27a0c99bff6710",
      "name": "Horário de funcionamento",
      "type": "image",
      "duration": 8,
      "archived": false,
      "organization": {
        "uid": "1679091c5a880faf6fb5e6087eb1b2dc",
        "name": "Loja Shopping Norte"
      }
    },
    {
      "uid": "6512bd43d9caa6e02c990b0a82652dca",
      "name": "Cardápio do dia",
      "type": "image",
      "duration": 10,
      "archived": false,
      "organization": {
        "uid": "8f14e45fceea167a5a36dedd4bea2543",
        "name": "Loja Centro"
      }
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 2,
    "total": 3,
    "total_pages": 2
  }
}