Pat Long - Munkii Yebee
Pat Long - Munkii Yebee

Reputation: 3639

nextLink in an Graph Api response not Absolute Uri

We are calling the graph api to get the users in our Azure B2C AD using this url

https://graph.windows.net/TENANTNAME.onmicrosoft.com/users?api-version=1.6&$top=10&$select=objectId,userType,displayName,signInNames,createdDateTime&$filter=userType%20eq%20'Member'

Note, the page size of 10 is deliberately small whilst I am writing this paging code

The docs say that if there is more data to pull there will be a nextLink property in the response and that if it is present that uri should be used to get the next page of data. We do see a nextLink to be more exact it is odata.nextLink however the value is not usable as a uri for the next request.

Here is an example

directoryObjects/$/Microsoft.DirectoryServices.User?$select=objectId,userType,displayName,signInNames,createdDateTime&$filter=userType%20eq%20'Member'&$skiptoken=X'010001000000030000005903BF45BBE7EA4CB7378BD076AD388026EC6A89C7479240A83DE15C99D42A0C4B7E5E4C707FB448B45655AED90920FA6D7126F4D8990'

Note, the skiptoken value as been shortened

I can parse that nextLink and assemble a uri for the next page but that seems like a stupid idea as the value of nextLink should be opaque to me.

Is it because we are calling a B2C tenant?

Is there an agreed approach for parsing that link?

Upvotes: 1

Views: 659

Answers (1)

Hury Shen
Hury Shen

Reputation: 15744

This is a problem caused by design, Azure AD graph api just provide this kind of nextlink. Actually, Microsoft is recommending to use Microsoft Graph in place of the Azure Active Directory Graph API in order to access Azure AD’s resources. So you can use Microsoft graph api "list users" to get the users in your AD, and it will show the absolute uri for the next link.

enter image description here

Upvotes: 1

Related Questions