'User List with API and Continuation Token for Azure Devops

To get a list off all the users, I am using Command: Get https://vssps.dev.azure.com/My Organization/_apis/graph/users?maxPageSize=2?api-version=6.0-preview.1

It returns 500 Users in response, But there is more.

There is a ContinuationToken in the documentation (https://docs.microsoft.com/en-us/rest/api/azure/devops/graph/users/list?view=azure-devops-rest-6.0) which will help me to get the rest of it.

I just don't know how to get and use that continuation token and the documentation is not clear.

Does anyone know how this works.



Solution 1:[1]

Based on the documentation here, continuation token is returned in X-MS-ContinuationToken response header.

You will need to parse response headers and extract the value of this token from there. Once you get the continuation token, you will need to include it in your next request. The query parameter where you will pass this information in is continuationToken.

Your request to fetch next set of users would look something like:

https://vssps.dev.azure.com/myorganization/_apis/graph/users?maxPageSize=2&api-version=6.0-preview.1&continuationToken={continuation-token-value}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wim Kok