Update a role
const url = 'https://example.com/api/security/roles/example';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","description":"example","roles":["example"],"groups":["example"],"repos":[{"CACHE_ROOT":"my-repo","id":"repo-123","permission":"write"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/api/security/roles/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "description": "example", "roles": [ "example" ], "groups": [ "example" ], "repos": [ { "CACHE_ROOT": "my-repo", "id": "repo-123", "permission": "write" } ] }'Updates an existing role
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Role ID
Request Body
Section titled “Request Body”object
Display name
Description
Role assignments
Group memberships
Repository permissions
object
Repository namespace
Example
my-repoRepository ID
Example
repo-123Permission level (view, write, admin)
Example
writeResponses
Section titled “Responses”Role updated successfully
object
Role ID
Searchable ID
Role name
Groups with this role
Users with this role
Repository permissions (legacy coarse model)
object
Repository namespace
Repository ID
Permission level (view, write, admin)
Entity type
Role description
Permission bundle IDs this role inherits from
Granular permission grants on this role, in addition to bundle-derived permissions
object
Permission keys held by this role at global scope
Per-repo permission grants keyed by repo ID. Type-qualified entries take the form ‘
object
Per-site permission grants keyed by site ID
object
Global grant/revoke applied on top of bundle and per-scope permissions
object
Permission keys granted in addition to bundles, applied globally
Permission keys revoked from the bundle-derived set, applied globally
Example
{ "id": "editor", "searchId": "editor", "name": "Editor", "groups": [], "users": [], "repos": [], "type": "role", "description": "", "bundles": [], "permissions": { "global": [], "repos": {}, "sites": {} }, "overrides": { "grant": [], "revoke": [] }}Invalid request