POST /command/users/add-roles
Assign roles to a user.
Request format
When Forming RBAC API requests to this endpoint, the content type
is application/json
. The body must be a JSON object
using the following keys:
user_id
: The ID of the user you want to assign roles to.role_ids
: An array of role IDs defining the roles that you want to assign to the user. An empty array is valid, but the user can't do anything in PE if they are not assigned to any roles.
Example payload:
{ "user_id": <user-id>, "role_ids":[1,2,3] }
Example curl request:
curl -X POST "https://$(puppet config print server):4433/rbac-api/v1/command/users/add-roles" \ -H "X-Authentication: $(puppet-access show)" \ -H "Content-type: application/json" \ -d '{"user_id": "c97c716a-5f42-49d8-b5a4-d0888a879d21", "role_ids": [1]}'
To assign multiple users to the same role at once, use the POST /command/roles/add-users endpoint.
Response format
Returns 204 No Content if the roles are successfully assigned to the user.
For errors, refer to RBAC service errors .