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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jrush4
Frequent Visitor

Help with pagination, cursor and limit

I've been pulling my hair out all day trying to work this out. I've been using the Trading212 API to pull info from a demo account, but when trying to pull whole order history I'm facing an issue due to pagination.

 

I've had it working with varying degrees of success - but every time I get close, something seems to go wrong.

 

I'm currently working with the below Power Query code, if anyone could help. 

 

let

baseUrl = "https://demo.trading212.com",

relativePath = "/api/v0/equity/history/orders?limit=4",

url = baseUrl & relativePath,

headers = [#"Authorization" = "000000000000000000"],

response = Web.Contents(

url,

[Headers = headers]

),

jsonResponse = Json.Document(response),

#"Converted to Table" = Record.ToTable(jsonResponse)

in

#"Converted to Table"

 

the output of that looks like the below.

I need to expand the list, and merge the nextPagePath with the baseUrl to get the next page of results.

If anyone could nudge me in the right direction, that would be great.

 

thank you

 

NameValue

items [List]

nextPagePath /api/v0/equity/history/orders?cursor=1728059206000&limit=4&instrumentCode

1 REPLY 1
lbendlin
Super User
Super User

Please follow the documentation. Use RelativePath and Query parameters. https://learn.microsoft.com/en-us/powerquery-m/web-contents#example-1

 

Here is a ready-made convenience function:  Handling paging for Power Query connectors - Power Query | Microsoft Learn

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.