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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register 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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.