API to list User for specific Role Group

This article discusses how about API to list User for specific Role Group.

The API for getting the Users for a specific role group :

https://apidocs.harness.io/tag/User/#operation/getAggregatedUsers

Here we need to input values for :

REQUEST BODY SCHEMA:
application/jsonapplication/yamlapplication/json

|resourceGroupIdentifiers|Array of strings unique|
|roleIdentifiers|Array of strings unique|

You should get the result.

For the Resource Idendifier value you can get it from the Resource group in Harness UI and the roleidentifier is the identifier for the role , which you could also get from the : https://apidocs.harness.io/tag/Roles#operation/getRoleList

Below Sample request to list all admin from the account :

curl -i -X POST \
  'https://app.harness.io/gateway/ng/api/user/aggregate?accountIdentifier=xxxxxxxxxxxxxx&orgIdentifier=string&projectIdentifier=string&searchTerm=string&pageIndex=0&pageSize=50&sortOrders=fieldName%3Dstring%26orderType%3DASC&pageToken=string' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  -d '{
    "resourceGroupIdentifiers": [
      "_all_resources_including_child_scopes"
    ],
    "roleIdentifiers": [
      "_account_admin"
    ]
  }'

1 Like