User populations


User populations API operations

The user populations endpoints support the following operations:

For hands-on experience with the users API endpoints, click the Run in Postman button below to download a Postman collection that you can import and open in your local Postman application.

Users data model

Property Description
id A string that specifies the population ID associated with the user resource ID identified in the request URL.

Response codes

Code Message
200 Successful operation.
201 Successfully created.
204 Successfully removed. No content.
400 The request could not be completed.
401 You do not have access to this resource.
404 The requested resource was not found.

Endpoint examples

Get user population setting

To get the population ID associated with a single user resource, the GET /environments/{environmentId}/users/{userId}/population operation returns the population setting for the user resource with the ID specified in the request URL.

curl -X GET "https://api.pingone.com/v1/environments/{environmentId}/users/{userId}/population" \
-H "Authorization: Bearer jwtToken"

The response data looks like this:

{
    "_links": {
        "self": {
            "href": "https://api.pingone.com/v1/environments/5da98f13-ad62-4234-ba04-2b6e2e85c8ca/populations/a701eb22-849d-4168-b756-6c20fc087c2f"
        },
        "environment": {
            "href": "https://api.pingone.com/v1/environments/5da98f13-ad62-4234-ba04-2b6e2e85c8ca"
        }
    },
    "id": "a701eb22-849d-4168-b756-6c20fc087c2f",
}

Update user population setting

To move a user from one population to another, you need to know the ID of the new population resource to associate with the user. To retrieve the list of all population IDs for a specified environment, you can call the GET /environments/{environmentId}/populations method.

The following sample shows the PUT /environments/{environmentId}/users/{userId}/population operation to associate the user with the different population.

curl -X "PUT" "https://api.pingone.com/v1/environments/{environmentId}/users/{userId}/population" \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer jwtToken' \
-d $'{
  "id": "21731b50-6b54-41b0-8454-9cd9de62a7a1"
}'

In the request body, the id attribute value is the population ID for the new population to associate with the user.