Reference · Files

List files

GET /v1/files

Lists the files of the organisations where the user can see files, from newest to oldest.

Paginated response: items come in data and the page information in meta. Pagination and filters

Parameters

NameTypeDescription
organizationstringuid of an organisation, to return only its items (see /organizations).
qstringPart of the name, up to 100 characters.
typestringFile type, such as image or video.
archivedinteger1 for archived files only or 0 for non-archived files only. Without it, all files are returned.
pageintegerPage, starting at 1. Default: 1.
per_pageintegerItems per page, from 1 to 100. Default: 50.

Fields of each item

uid string
File identifier.
name string
File name in the control panel.
type string
File type, such as image or video.
duration integer
Duration, in seconds.
archived boolean
true if the file is archived.
organization object
Organisation of the file: uid and name.

Possible errors

  • 400 invalid_parameter A parameter has an invalid value, such as per_page above the maximum.
  • 404 organization_not_found The organization given is not an organisation where the user can see this type of item.
  • Key and rate limit errors apply to every endpoint. See all errors
Request
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();
Response200
{
  "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
  }
}