Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Calling Paginated API with an "endCursor" variable that needs to be passed to subsequent calls

Hey there. 

I'm looking for help for a bit of a complicated problem. 

 

I have a connection to a REST API that returns a pagination variable to send on subsequent API requests to retrieve the next page. 

I am trying to loop through the pages and get all the data into PBI desktop but am having trouble doing so with this endCursor variable.

Here's an example response for a call with an "endCursor"(the variable in question) and a "hasNextPage":

 
"pagination": {
        "endCursor": "(random variable is here)",
        "hasNextPage": true
    }
 
I'm not sure how I would be able to pass the variable into the "RelativePath" and have it loop through all the data.
Has anyone done this successfully?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

Perhaps you can take a look at the 'GenerateByPage' helper function to create a custom function to iterator and expand records based on the page number:
Helper functions for M extensions for Power Query connectors - Power Query | Microsoft Docs

Regards.

Moonlight

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

HI @Anonymous,

Perhaps you can take a look at the 'GenerateByPage' helper function to create a custom function to iterator and expand records based on the page number:
Helper functions for M extensions for Power Query connectors - Power Query | Microsoft Docs

Regards.

Moonlight

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.