Create a Group and Add a User
Number of APIs: 6
This activity shows you how to create a group and assign a user to that group.
Prerequisites
Get an access token from the worker application that you created in Getting Started with the PingOne APIs. To get a token from a different worker application in an alternate sandbox environment, run the token request endpoint using the client ID and client secret of your chosen worker app to authenticate the request. For more information, see GET a Worker Application Access Token.
Workflow order of operations
To create a group and add a user, you must complete the following tasks:
Make a
POSTrequest to/environments/{{envID}}/groupsto create a new group.Make a
POSTrequest to/environments/{{envID}}/populationsto create a new population resource.Make a
POSTrequest to/environments/{{envID}}/usersto create a user to assign to the new population resource.Make a
POSTrequest to/environments/{{envID}}/users/{{GroupUseCaseUserID}}/memberOfGroupsto add the new user to the group.Make a
GETrequest to/environments/{{envID}}/users?filter=memberOfGroups[id eq "{{UseCaseGroupID}}"]to return a list of all users in the group.Make a
GETrequest to/environments/{{envID}}/users/{{GroupUseCaseUserID}}?include=memberOfGroupNamesto return a list of all groups associated with the specified user.
-
Step 1: Create a group POST {{apiPath}}/environments/{{envID}}/groups
-
Step 2: Create a population for users POST {{apiPath}}/environments/{{envID}}/populations
-
Step 3: Create a user POST {{apiPath}}/environments/{{envID}}/users
-
Step 4: Add user to group POST {{apiPath}}/environments/{{envID}}/users/{{GroupUseCaseUserID}}/memberOfGroups
-
Step 5: Read all users in a group GET {{apiPath}}/environments/{{envID}}/users?filter=memberOfGroups[id eq "{{UseCaseGroupID}}"]
-
Step 6: Read all group names for a user GET {{apiPath}}/environments/{{envID}}/users/{{GroupUseCaseUserID}}?include=memberOfGroupNames