Create User Role Assignment
POST {{apiPath}}/environments/{{envID}}/users/{{userID}}/roleAssignments
You can manage the roles assigned to specific users. When you assign a role to a user, you provide the attribute values required to identify the role and designate the role assignment scope for this user.
The sample shows the POST /environments/{{envID}}/users/{{userID}}/roleAssignments
operation to create the role assignment for the user in the specified environment resource.
The request URL identifies the environment ID and user ID. The request body specifies the role
ID and the scope
attribute values. The scope
attribute provides the resource ID and resource type to designate the role assignment scope associated with this actor. In this sample, the scope type
is ENVIRONMENT
and the specific environment to which the role assignment scope applies is specified in the id
value.
When scope.type
is POPULATION
, the maximum number of roles you can assign is 250.
Prerequisites
See Users and User Role Assignments for important overview information.
Create a user to get a
userID
. See Create User. Run Read User or Users to find an existing user.Run Read User or Roles to find a
roleID
.
Property | Type | Required? |
---|---|---|
role.id | String | Required |
scope.id | String | Required |
scope.type | String | Required |
See the User role asignments data model for full property descriptions.
Request Body
{"role"=>{"id"=>"{{roleID}}"}, "scope"=>{"id"=>"{{envID}}", "type"=>"ENVIRONMENT"}}
RESPONSES
status: Created
{"_links":{"self":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8ce55f02-2077-4493-9a6d-0385df1f0772/roleAssignments/d9b890bc-e8a8-4fd4-8650-a39c046fe5aa"},"user":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/8ce55f02-2077-4493-9a6d-0385df1f0772"},"environment":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"}},"id":"d9b890bc-e8a8-4fd4-8650-a39c046fe5aa","scope":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6","type":"ENVIRONMENT"},"role":{"id":"0bd9c966-7664-4ac1-b059-0ff9293908e2"},"environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"readOnly":false,"user":{"id":"8ce55f02-2077-4493-9a6d-0385df1f0772"}}