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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mrgou
Frequent Visitor

Paging REST API results

I realize that this question has been posted a thousand times, but I just couldn't find an answer to my specific case nonetheless.

So I'm querying a REST API, which returns paged results. I thus need to iterate in this way: based on the size of the last page (which is a field in the JSON response), increment a REST query parameter to get the next page, until the next page contains no records. In pseudo-code:

 

 

content ← True
i ← 1
While content
    response ← get(url, http_parameters=['start' = i])
    results ← results + response['records']
    i ← i + response['size']
    content ← size(response['records']) > 0
Endwhile

 

 

Can anyone explain how this can be realized in Power Query? I understand that there's a Table.GenerateByPage function, but Microsoft's documentation isn't great when learning from scratch.

Base code for the time being:

 

 

let
    rooturl = "https://my.apiservice.com/",
    Source =
        Web.Contents(
            rooturl,
            [
                Headers = [
                    #"Content-Type" = "application/json"
                ],
                RelativePath = "api/rest/endpoint"
            ]
        )
in
    Source

 

 

Any hint to the right track will be much appreciated! Thanks in advance!

 

 

1 REPLY 1
v-lionel-msft
Community Support
Community Support

Hi @mrgou ,

 

Maybe you can try to do like this.

v-lionel-msft_0-1617182877283.png

v-lionel-msft_1-1617182905766.png

 

Or try this.

v-lionel-msft_2-1617182958671.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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