Update a Role

Updates parameters of 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.

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.

To find the resource_id, run a Retrieve all Roles call.

📘

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 and Resource Permissions documentation.

For information about finding the resource_type at the environment level, see the Granular Environment Permissions documentation.

📘

System fields (id, created_by, created_at, and updated_at) cannot be updated or changed. If included in the Update payload, these fields must be an exact match to the role in the system.

Sample Call

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"
          }
     ]
}'
Language