Hello everyone,
Â
I hope someone can help me with this.
I am working on getting Azure AD Groups via the Graph API and then retrieving the members through a nested API call.
I saw a post concerning a nested REST API call together with pagination in which one of the commenters (Gijs) had the exact same API which I am also using (commented by Gijs):
https://support.timextender.com/rsd-file-customization-96/using-a-nested-rest-api-in-combination-with-paging-858
However, the suggestion didn't work for my use-case as it only ‘expanded’ the nested values, but didn't paginate. I only got the members of the first 100 groups.
I used the RSD-file from the commenter Gijs with the addition of two points:
- two additional rows to enable pagination;
- lmemberout.userPrincipalName| allownull()] instead of tmemberout.userPrincipalName] as I was getting a t500] error with this specific attribute.
I've made them bold in the code down below.
Would someone be able to give me some pointers to what I'm missing in the RSD file to enable pagination on this nested REST API call?
Kind regards,
Johnny Yang
This is what I have written in the RSD file:
Â
“
<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <!-- See Column Definitions to specify column behavior and use XPaths to extract column values from JSON. -->
 <api:info title="GraphGroupMembers_Test2" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
  <!-- You can modify the name, type, and column size here. -->
  <attr name="GroupId"      xs:type="string"  readonly="false" other:xPath="groupId"       />
  <attr name="GroupDisplayName"  xs:type="string"  readonly="false" other:xPath="groupDisplayName"  />
  <attr name="GroupDescription"  xs:type="string"  readonly="false" other:xPath="groupDescription"  />
  <attr name="UserId"       xs:type="string"  readonly="false" other:xPath="userId"       />
  <attr name="UserDisplayName"  xs:type="string"  readonly="false" other:xPath="userDisplayName"   />
  <attr name="UserPrincipalName" xs:type="string"  readonly="false" other:xPath="userPrincipalName"  />
  <!-- Attributes are used for passing to child API call -->
  <attr name="Id"         xs:type="string"  readonly="false" other:xPath="id"         />
  <attr name="DisplayName"    xs:type="string"  readonly="false" other:xPath="displayName"     />
  <attr name="Description"    xs:type="string"  readonly="false" other:xPath="description"     />
 </api:info>
 <api:set attr="groupin.DataModel" value="DOCUMENT" />
 <api:set attr="groupin.JSONPath" value="/value" />
 <api:set attr="groupin.URITemplate" value="https://graph.microsoft.com/v1.0/groups?$select=id,displayName,description" />
 <api:set attr="groupin.pageurlpath" value="/\u@odata.nextLink\]"    />     Â
 <api:set attr="groupin.RepeatElement" value="/value/"             />        Â
Â
 <api:set attr="groupin.ElementMapPath#" value="/value/id" />
 <api:set attr="groupin.ElementMapName#" value="group_id" />
 <api:set attr="groupin.EnablePaging" value="TRUE" />
 <api:set attr="memberin.DataModel" value="DOCUMENT" />
 <api:set attr="memberin.EnablePaging" value="TRUE" />
 <api:set attr="memberin.JSONPath" value="/value" />
 <api:set attr="memberin.URITemplate" value="https://graph.microsoft.com/v1.0/groups/{groupId}/members?$select=id,displayName,userPrincipalName" />
 Â
 Â
 <!--api:set attr="JSONPath" value="" /-->
 <!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. -->
 <api:script method="GET">
  <api:set attr="groupin.URI" value="egroupin.URITemplate]" />
  <!-- Get the groups -->
  <api:call op="jsonproviderGet" in="groupin" out="groupout">
   <api:set attr="memberin.groupId" value=" groupout.id]" />
   <api:set attr="memberin.groupDisplayName" value="pgroupout.displayName | allownull()]" />
   <api:set attr="memberin.groupDescription" value="Âgroupout.description | allownull()]" />
   <api:set attr="memberin.URI" value="(memberin.URITemplate | replace('{groupId}', mmemberin.groupId])]" />
   <!-- Get the members of the group -->
   <api:call op="jsonproviderGet" in="memberin" out="memberout">
    <api:set attr="out.userId" value=" memberout.id]" />
    <api:set attr="out.userDisplayName" value="omemberout.displayName]" />
    <api:set attr="out.userPrincipalName" value="Imemberout.userPrincipalName| allownull()]" />
    <api:set attr="out.groupId" value="]memberin.groupId | allownull()]" />
    <api:set attr="out.groupDisplayName" value="mmemberin.groupDisplayName | allownull()]" />
    <api:set attr="out.groupDescription" value="umemberin.groupDescription | allownull()]" />
    <api:push item="out"/>
      <!--api:push/-->
   </api:call>
  </api:call>
 </api:script>
...
</api:script>
“