Graph API Paging

When first using Graph API a feature I missed was that data was paged. For example, if I want to retrieve all the groups in a tenant, I would use the following endpoint:


This worked fine for me in the demo tenants I was using – I would get all the groups back.

However, I found out there is a limit to results returned (for groups it is 100)! This is down to paging (see explanation here).

If you look closely at a response JSON payload back from Graph API there is sometimes an attribute @odata.nextLink.

    "@odata.context": "$metadata#groups",
    "@odata.nextLink": "$skiptoken=X%27445370740200010000002A47726F75705F31336265363937312D373964622D346633332D396434312D6232353538396361323561662A47726F75705F31336265363937312D373964622D346633332D396434312D6232353538396361323561660000000000000000000000%27",
    "value": [
            "id": "02bd9fd6-8f93-4758-87c3-1fb73740a315",
            "deletedDateTime": null,
            "classification": null,
            "createdDateTime": "2017-07-31T18:56:16Z",
            "creationOptions": [


This attribute means the data you have been returned is incomplete and there is more (pages of) data to get. It’s really easy to get the next ‘page’ of data – you just query the link in the value of @odata.NextLink.

HTTP GET:$skiptoken=X%27445370740200010000002A47726F75705F31336265363937312D373964622D346633332D396434312D6232353538396361323561662A47726F75705F31336265363937312D373964622D346633332D396434312D6232353538396361323561660000000000000000000000%27

You may also find that data also has a @odata.nextLink in too, so repeat the process.

To better illustrate this, I have a code snippet of getting data on a loop using PowerShell:

I am sure this can be done in other languages using a ‘while’ loop to get all data.

See also

comments powered by Disqus