Skip to main content

Hello,

I am trying to extract data from azure AD. I am at the point where I can get data using the microsoft Graph API, and have it loaded into Timextender.

The issue I am facing has to do with pagination. Microsoft graph API returns an url containing information of the next 'page’ of data. According to documentation I should adjust my RSD file as follows:

  <api:set attr="DataModel" value="DOCUMENT" />
  <api:set attr="URI" value="https://graph.microsoft.com/v1.0/groups" /> 
  
  <api:set attr="EnablePaging" value="true" />
  <api:set attr="pageurlpath" value="/json/@odata.nextLink" />
  <api:set attr="RepeatElement" value="/json/value/" />

This does not however loop over the pages, but still only gives me a top 100 of groups. I have a feeling maybe I need to escape either the @ or the . in the pageurlpath. Or am I missing something more obvious?

 

Kind regards,

Rutger

Hi Rutger,

Thank you for sharing your support issue regarding the Microsoft Graph API. 

The following knowledge base article discusses how to use RSD files in a similar technique:

Creating and using RSD files for CData providers – TimeXtender Support

Please review the section on pagination and pageurlpath to see if that is helpful in resolving your issue.

Best regards,

Greg Lennox


Hey Greg,

Thanks for your reply, I have used this documentation. The relevant section for graph API seems to be: 

“Next Page URL”
 

I have also tried using the example api in that section (swapi.dev). That works just fine. I have also tried returning the value of the graph api on @odata.nextLink and just 'log’ it in a sql column. This I also was not able to do, which again leads me to believe that something does not go well with accessing this path with an @ or a . 
 

Kind regards,
Rutger


Did you add a rows@next input to the api:info part of the rsd?


Hi Rutger

I do not have enough groups for this to be an issue, but I can get the same options in my Users call now that I have an app with users.read.all rights.

However, my old users RSD file may help you. It iterates over groups, where one group may contain less users than necessary to iterate over.

In the mean time I will see if I can figure out what is blocking this from working, it may be an escape issue.

Also when using pagination it is important to set it to run with pagination by setting it to true, but it is not always necessary to add the rows@next part.


Hi @RutgerNijland were you able to resolve this issue? Have you had a chance to look at the rsd file Thomas attached above?


Hey Christian, as a workaround that works, because now I iterate over groups containing users, which luckily in this case does not exceed 999 groups, or 999 users per group.

This however will not work when the amount of groups or user per group will grow past this maximum of 999 (which is already getting close for this specific customer), it also only works if all users are assigned to security group in Azure AD.


Hi Rutger

Sorry for the delay. I found an old ticket in the other system with a solution to this, for once CData was of no help.

Change this

<api:set attr="pageurlpath" value="/json/@odata.nextLink" />

To this

<api:set attr="pageurlpath" value="/\[@odata.nextLink\]" />

And it will work.

I tried to do escapes, but I did not know I had to apply [] around the thing. Whenever you use square brackets you need to escape them with a \ or it will expect it to be an input field of some sort.


Hey Thomas,

I have tested this and it works! Thanks for your help


Reply