0

Get API capabilities

by
Published Oct 1, 2022

Requests what an OCS endpoint is capable of. Returns an XML document on success. https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#capabilities-api

Script ocs Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 9 days ago
1
//native
2

3
// https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#capabilities-api
4
// Should return an XML document on success.
5
export async function main(baseUrl: string) {
6
  const resp = await fetch(`${baseUrl}/ocs/v1.php/cloud/capabilities`, {
7
    headers: {
8
      "OCS-APIRequest": "true",
9
    },
10
  });
11
  if (!resp.ok) {
12
    throw Error(`HTTP Error ${resp.status} - ${await resp.text()}`);
13
  }
14
  return await resp.text();
15
}
16

Other submissions
  • Submitted by jaller94 Deno
    Created 401 days ago
    1
    // https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#capabilities-api
    2
    // Should return an XML document on success.
    3
    export async function main(baseUrl: string) {
    4
      const resp = await fetch(`${baseUrl}/ocs/v1.php/cloud/capabilities`, {
    5
        headers: {
    6
          "OCS-APIRequest": "true",
    7
        },
    8
      });
    9
      if (!resp.ok) {
    10
        throw Error(`HTTP Error ${resp.status} - ${await resp.text()}`);
    11
      }
    12
      return await resp.text();
    13
    }
    14