List roles
const url = 'https://example.com/api/security/roles';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/api/security/roles \ --header 'Authorization: Bearer <token>'Retrieves all roles in the system
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”Roles retrieved successfully
object
Total number of roles
Array of roles
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
{ "items": [ { "id": "editor", "searchId": "editor", "name": "Editor", "groups": [], "users": [], "repos": [], "type": "role", "description": "", "bundles": [], "permissions": { "global": [], "repos": {}, "sites": {} }, "overrides": { "grant": [], "revoke": [] } } ]}