VSTS Pull request API - how to get the IdentityRef

1) Use Graph - List Users, but also check for a X-MS-ContinuationToken response header to determine if there is still additional paged data to be retrieved. If so, resend the request with the continuation token value until all values are returned:

  • GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?api-version=5.0-preview.1, followed by
  • GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?continuationToken={continuationToken}&api-version=5.0-preview.1

(I'm wondering if this is why you are only getting 500 users per your comment above. Unfortunately the documentation doesn't list the max page size for this API. If you are using the continuation token and all users are not being returned, that sounds like an API bug to me.)

2) Use Get User Entitlements. This provides top and skip parameters. The top parameter has a 10000 record limit per the documentation.

  • GET https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?top=10000&api-version=5.0-preview.2