參考資料 · 檔案

列出檔案

GET /v1/files

由新至舊列出用戶可查看檔案的公司中的檔案。

分頁回應:項目放在 data 內,分頁資料則放在 meta 內。 分頁及篩選

參數

名稱類型說明
organizationstring公司的 uid,用於只傳回該公司的項目(請參閱 /organizations)。
qstring名稱的部分文字,最多 100 個字元。
typestring檔案類型,例如 image 或 video。
archivedinteger1 表示只傳回已封存的檔案,0 表示只傳回未封存的檔案。如不提供此參數,則傳回所有檔案。
pageinteger頁數,由 1 開始。預設值:1。
per_pageinteger每頁項目數目,由 1 至 100。預設值:50。

每個項目的欄位

uid string
檔案識別碼。
name string
檔案在控制台中的名稱。
type string
檔案類型,例如 image 或 video。
duration integer
長度,以秒為單位。
archived boolean
如檔案已封存,則為 true。
organization object
檔案所屬的公司:uid 及 name。

可能出現的錯誤

  • 400 invalid_parameter 某個參數的值無效,例如 per_page 超出上限。
  • 404 organization_not_found 所提供的 organization 並非該用戶可查看此類項目的公司。
  • 金鑰錯誤及次數限制錯誤適用於所有端點。 查看所有錯誤
請求
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();
回應200
{
  "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
  }
}