Update site access settings for an authorized application
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
Must be exactly "oauth_application".
Whether the application can access all projects or only selected ones
"selected"
The application can access all projects
The application can only access selected projects
Projects to grant access to (required when site_access_mode is 'selected')
Returns
Returns a resource object of type oauth_application.
Examples
PUT https://site-api.datocms.com/oauth_applications/:field_id_or_api_key HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Content-Type: application/vnd.api+json
{ "data": { "id": "312", "type": "oauth_application", "attributes": { "site_access_mode": "selected" } }}curl -g 'https://site-api.datocms.com/oauth_applications/:field_id_or_api_key' \ -X PUT \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3" \ -H "Content-Type: application/vnd.api+json" \ --data-binary '{"data":{"id":"312","type":"oauth_application","attributes":{"site_access_mode":"selected"}}}'await fetch( "https://site-api.datocms.com/oauth_applications/:field_id_or_api_key", { method: "PUT", headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", "Content-Type": "application/vnd.api+json", }, body: JSON.stringify({ data: { id: "312", type: "oauth_application", attributes: { site_access_mode: "selected" }, }, }), },);HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": { "type": "oauth_application", "id": "312", "attributes": { "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 }, "relationships": { "granted_sites": { "data": [ { "type": "site", "id": "155" } ] } } }}