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
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