POST /command/roles/add-users
Assign a role to one or more users.
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:
role_id
: The ID of the role you want to assign users to.user_ids
: An array of user IDs defining the users that you want to assign to the role.
Example payload:
{ "role_id": <role_id>, "user_ids": [<user_id1>, <user_id2>, <user_id3>, ...]}
Example curl request:
curl -X POST "https://$(puppet config print server):4433/rbac-api/v1/command/roles/add-users" \ -H "X-Authentication:$(puppet-access show)" \ -H "Content-type: application/json" \ -d '{"role_id": 1, "user_ids": ["5c1ab4b0-588b-11e4-8ed6-0800200c9a66"]}'
To assign multiple roles to a single user at once, use the POST /command/users/add-roles endpoint.
Response format
Returns 204 No Content if the users are successfully assigned the role.
Returns 404 Not Found if any of the users don't exist.
For other errors, refer to RBAC service errors .