Roles
The Roles API is a tool to help you manage user roles in the BigPanda system, enabling you to bulk manage even large and complex permissions.
Use the Roles API to create, retrieve, update, and delete roles from the BigPanda UI.
Authentication
All BigPanda APIs require Bearer Token Authorization in the call headers.
This API uses the User API Key type of Authorization token.
BigPanda recommends adding Authentication headers only in the secure tool you use to make API calls.
Roles
Authentication
All BigPanda APIs require Bearer Token Authorization in the call headers.
This API uses the User API Key type of Authorization token.
BigPanda recommends adding Authentication headers only in the secure tool you use to make API calls.
curl --request POST \ --url https://api.bigpanda.io/resources/v2.1/roles \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>' \ --header 'Content-Type: application/json' \ --data ' { "name": "Test Role", "users": [ "60c5238222fa63633d935555" ], "permissions": [ { "resource_type": "environments", "resource_id": "624e114fb4d7581100179111", "actions": [ "read" ] }, { "resource_type": "users", "actions": [ "read" ] } ] } '
curl --request POST \ --url https://eu-api.bigpanda.io/resources/v2.1/roles \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>' \ --header 'Content-Type: application/json' \ --data ' { "name": "Test Role", "users": [ "60c5238222fa63633d935555" ], "permissions": [ { "resource_type": "environments", "resource_id": "624e114fb4d7581100179111", "actions": [ "read" ] }, { "resource_type": "users", "actions": [ "read" ] } ] } '
curl --request GET \ --url https://api.bigpanda.io/resources/v2.1/roles/60c5238222fa63633d95555f \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>'
curl --request GET \ --url https://eu-api.bigpanda.io/resources/v2.1/roles/60c5238222fa63633d95555f \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>'
curl --request GET \ --url 'https://api.bigpanda.io/resources/v2.1/roles?page=3&per_page=20&direction=desc&sort=name' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>'
curl --request GET \ --url 'https://api.bigpanda.io/resources/v2.1/roles?page=3&per_page=20&direction=desc&sort=name' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>'
curl --request PUT \ --url https://api.bigpanda.io/resources/v2.1/roles/60c5238222fa63633d95555f \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>' --data ' { "name": "Test Role", "users": [ "60c5238222fa63633d935555" ], "permissions": [ { "resource_type": "environments", "resource_id": "624e114fb4d7581100179111", "actions": "read" }, { "resource_type": "users", "actions": "read" } ] }'
curl --request PUT \ --url https://api.bigpanda.io/resources/v2.1/roles/60c5238222fa63633d95555f \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>' --data ' { "name": "Test Role", "users": [ "60c5238222fa63633d935555" ], "permissions": [ { "resource_type": "environments", "resource_id": "624e114fb4d7581100179111", "actions": "read" }, { "resource_type": "users", "actions": "read" } ] }'
curl --request DELETE \ --url https://api.bigpanda.io/resources/v2.1/roles/60c5238222fa63633d95555f \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>'
curl --request DELETE \ --url https://eu-api.bigpanda.io/resources/v2.1/roles/60c5238222fa63633d95555f \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <User API Key>'
Parameters
The Roles object schema includes the following attributes:
Attribute | Description | Type |
---|---|---|
name | The name of the role as seen in the UI. | String |
id | Unique system identifier for the role. | String |
users | An array of user IDs associated with the role. | Array |
created_by | The unique ID associated with the user who created the role. | String |
created_at | Unix epoch time when the role was created (in seconds). | Timestamp |
updated_at | Unix epoch time when the role was last updated (in seconds). | Timestamp |
permissions | A list of permissions associated with the role. Each permission grants access to a specific resource_type, which is an area in BigPanda. See Roles and Resource Permissions for more information. Attributes: resource_id - (Optional) The id of the permission. This field is only necessary when the role grants access to a specific environment. For all other roles, this field should be left blank. See the Environments Roles documentation for more information. actions - An array of available actions this permission grants Options include: read, full_access, incident_actions (incident_actions is only available for environment type permissions.) resource_type - The name of the permission type | Array |
Resource ID
The resource_id
field within the permissions array is only necessary when the role grants access to a specific environment. For all other permission types, this field should be omitted.
Resource type
The resource_type
field is the name of the permission, without the access level. For example, roles
rather than roles_read
.
For a list of available permission types, see the Roles Management documentation.
For information about finding the resource_type
at the environment level, see the Granular Environment Permissions documentation.
System fields
System fields (id
, created_by
, created_at
, and updated_at
) will be set automatically. If included in the Create payload, these fields will be discarded.
Updating a role
You are able to update name, users, and permissions in a single call.
Any differences between the existing role and fields in the Update call will be applied. This includes incomplete parameters.
The full list of users and permissions must be included in each update call. For example, if a role has eight permissions and only one is included in the call, the role will be updated to only have the one permission.
Sample Roles Object
{ "name": "Admin", "users": [ "60c5238222fa63633d935555", "5555238222fa63633d93560c" ], "permissions": [ { "resource_type": "environments", "resource_id": "624e114fb4d7581100179111", "actions": "read" }, { "resource_type": "users", "actions": "read" } ] }