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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.