Primers passos

Paginació i filtres

Els llistats (/tvs, /files i /playlists) estan paginats. Els elements es retornen a data i la informació de la pàgina, a meta.

NomTipusDescripció
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 meta

page integer
Pàgina actual.
per_page integer
Elements per pàgina.
total integer
Total d'elements trobats, sumant totes les pàgines.
total_pages integer
Total de pàgines.

Per obtenir-ho tot, comenceu a page=1 i avanceu fins a arribar a total_pages. Una pàgina posterior a l'última retorna data buit.

Filtres

Els filtres es poden combinar entre ells i amb la paginació. El total de meta ja té en compte els filtres.

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. Només a /files.
archivedinteger1 per obtenir només els arxivats o 0 per obtenir només els no arxivats. Només a /files.

Ordre

Les TV i les llistes de reproducció es retornen en ordre alfabètic; els fitxers, del més recent al més antic.

Sol·licitud
curl "https://api.on-cloud.live/v1/tvs?per_page=2" \
  -H "X-API-Key: $API_KEY"
<?php
$ch = curl_init('https://api.on-cloud.live/v1/tvs?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/tvs?per_page=2', {
  headers: { 'X-API-Key': process.env.API_KEY }
});
const { data, meta } = await res.json();
Resposta200
{
  "data": [
    {
      "uid": "d3d9446802a44259755d38e6d163e820",
      "name": "Caixa 2",
      "description": "",
      "organization": {
        "uid": "1679091c5a880faf6fb5e6087eb1b2dc",
        "name": "Loja Shopping Norte"
      },
      "playlist": null,
      "status": "offline",
      "last_seen_at": "2026-11-01T18:04:51-03:00",
      "activated_at": "2025-03-12T09:41:05-03:00",
      "app_version": "3.12.83",
      "os": "android",
      "device": {
        "brand": "Philco",
        "model": "PTV32G70"
      },
      "timezone": "America/Sao_Paulo"
    },
    {
      "uid": "c98cb8f9cc62887d1f6cf5693df9219c",
      "name": "Recepção",
      "description": "TV da entrada",
      "organization": {
        "uid": "8f14e45fceea167a5a36dedd4bea2543",
        "name": "Loja Centro"
      },
      "playlist": {
        "uid": "e4da3b7fbbce2345d7772b0674a318d5",
        "name": "Lista principal"
      },
      "status": "online",
      "last_seen_at": "2026-11-03T14:32:10-03:00",
      "activated_at": "2025-03-12T09:41:05-03:00",
      "app_version": "3.12.84",
      "os": "android",
      "device": {
        "brand": "TCL",
        "model": "43P635"
      },
      "timezone": "America/Sao_Paulo"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 2,
    "total": 3,
    "total_pages": 2
  }
}
Paràmetre no vàlid400
GET /v1/tvs?per_page=500

{
  "error": {
    "code": "invalid_parameter",
    "message": "per_page must be a number between 1 and 100."
  }
}