Add User to Group
POST {{apiPath}}/environments/{{envID}}/users/{{userID}}/memberOfGroups
The POST /environments/{{envID}}/users/{{userID}}/memberOfGroups
operation directly adds one user to a specified group. The group ID is indicated in the body of the request. For more information on adding users to groups, see Adding users to groups.
Note: If a user is a member of a group that is added to a population, changing the user's population will remove the user from that group. Additionally, if a user's population changes, they are also removed from any group in this population in which they are a member.
For more information about groups, see Groups.
Admins cannot add or remove themselves from a a group with admin roles.
Prerequisites
See Users for important overview information.
Create a user to get a
userID
. See Create User. Run Read User or Users to find an existing user.Create a user group to get a
groupID
. See Create Group. Run Read All Groups to find an existing group.
Property | Type | Required? |
---|---|---|
id | String | Required |
See the Groups data model for full property descriptions.
Request Body
{"id"=>"{{groupID}}"}
RESPONSES
status: Created
{"_links":{"self":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/c98fd0cc-c34b-406a-9e0b-a892edb7a702/memberOfGroups/e947cec5-62c5-4d80-af16-497b29e8a685"},"user":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/users/c98fd0cc-c34b-406a-9e0b-a892edb7a702"},"environment":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"group":{"href":"https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/groups/e947cec5-62c5-4d80-af16-497b29e8a685"}},"id":"e947cec5-62c5-4d80-af16-497b29e8a685","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"name":"Managers","type":"DIRECT"}