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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
paulmorgan
Helper II
Helper II

REST API pull with pagination

I'm fairly new using APIs for building a Power BI report. I'm sure there is an easy way to do this, but I don't know how to proceed.

 

I have a single pull from a REST API.

 

Each page in the response is 1000 rows long. I need to figure out what type of Do/While loop to insert into the Advanced Editor so that it pulls 4 pages (my output is just over 3,000 rows).

 

Just using pageIndex=1 and pageSize=1000 (hardcoded), after converting to a table inside the Advanced Editor, I get the text below. What should I insert into this so that I pull however many pages are required to get the full output?

 

Thank you in adance.

 

let
Source = Json.Document(Web.Contents("https://api.connect.company.com/v1/retrieve?pageIndex=1&pageSize=1000")),

 

#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"geography_name", "geography_id", "region_name", "module_id", "module_name", "time_period_formatted", "time_period", "value", "rating_name", "parent_rating_name"}, {"geography_name", "geography_id", "region_name", "module_id", "module_name", "time_period_formatted", "time_period", "value", "rating_name", "parent_rating_name"})
in
#"Expanded Column1"

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @paulmorgan,

You can take a look at the following document about the help functions about processing pagination api if it meet your requirement:

Helper Functions#tablegeneratebypage 

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @paulmorgan,

You can take a look at the following document about the help functions about processing pagination api if it meet your requirement:

Helper Functions#tablegeneratebypage 

Regards,

Xiaoxin Sheng

lbendlin
Super User
Super User

Use a recursive function

 

getdata(offset,count)

 

Then inside that function do your API call.  If the result (returned rows) is the same as the count, increase the offset by one and call the function again.  If it is less, pack up, and return the collected rows back to the calling process.

Thank you for taking the time to respond.

 

I'm not that familiar with how to do what you suggest.

 

However, I will send this suggestion to someone in our development team and ask for assistance on how to implement.

 

Thanks again

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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