Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Dashboard API > OAuth application

Update site access settings for an authorized application

Warning: Experimental API

Please note that the Dashboard API is an experimental, prerelease API. This API method is considered unstable, and should be avoided in production environments and automations. Changes may occur at any time without warning.

Body parameters

site_access_modeenumRequired

Whether the application can access all projects or only selected ones

Example:"selected"
allOptional

The application can access all projects

selectedOptional

The application can only access selected projects

granted_sitesOptional

Projects to grant access to (required when site_access_mode is 'selected')

Type:Array&#x3C;<a href="/docs/content-management-api/resources/site">ResourceLinkage&#x3C;"site"></a>>

Returns

Returns a resource object of type oauth_application

Examples

import { buildClient } from "@datocms/dashboard-client";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const oauthApplicationId = "312";
const oauthApplication = await client.oauthApplications.update(
oauthApplicationId,
{ id: "312", site_access_mode: "selected" },
);
// Check the 'Returned output' tab for the result ☝️
console.log(oauthApplication);
}
run();
{
id: "312",
name: "Netlify OAuth application",
created_at: "2018-11-20 12:06:49.803166",
site_access_mode: "all",
read_sites_permission_cap: "unrestricted",
mcp_client: null,
granted_sites: [{ type: "site", id: "155" }],
}