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
Rocky_Road
Frequent Visitor

Getting data from paginated API

Im fairly new in Power bi. I worked through lot of different sugestions how to et data in from painated api, but i still can't figure it out what is the problem.

 

Here is code to get next page.

 

 

let
    Source = Json.Document(Web.Contents("https://xxxxxxxxxxxx?page[size]=2000&page[number]=1", [Headers=[Authorization="Bearer "&Gettoken()]])),
    links = Source[links],
    next = links[next]
in
    next

 

 

 

Here is code to get data from 10 pages. 

 

 

let
iterations = 10, // Number of iterations
url = "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
FnGetOnePage =
(url) as record =>
let
Source = Json.Document(Web.Contents(url),[Headers=[Authorization="Bearer "&Gettoken()]]),
data = try Source[data] otherwise null,
next = try Source[links] [next] otherwise null,
res = [Data=data, Next=next]
in
res,

GeneratedList =
List.Generate(
()=>[i=0, res = FnGetOnePage(url)],
each [i]<iterations and [res][Data]<>null,
each [i=[i]+1, res = FnGetOnePage([res][Next])],
each [res][Data])
in
GeneratedList

 

 


Can someone point me into right direction. Thank you for advance 🙂

1 ACCEPTED SOLUTION
Rocky_Road
Frequent Visitor

1 REPLY 1
Rocky_Road
Frequent Visitor

Hello again, 

 

I found working logic from here: https://stackoverflow.com/questions/73832274/power-query-pagination

 

 

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.