Forum Discussion
Anonymous
6 years agoNot applicable
Cursor Paginated data from Web API
Hi, I am calling a web api to grab some data which is paginated and I am struggling with how to get the next page of data as it is cursor based. When I call the api in PowerQuery (I'm connect...
ImkeF
6 years agoCommunity Champion
Hi Anonymous ,
one day, we'll get there 😉
let
myList = List.Generate( ()=>
[Result = Query4("https://api.brighttalk.com/v1/channel/10737/webcasts"), Counter = 0],
each [Counter] < 5,
each [Result = Query4(Table.LastN([Result]{[Name = "link"]}[Table], 1){0}[#"Attribute:href"]), Counter = [Counter]+1],
each [Result])
in
myList
Anonymous
6 years agoNot applicable
Hi ImkeF ,
I think that day has arrived! We have success!!!
I now get a result set of Tables as expected:
Can I ask one more question please? Ultimatley I need to replace the Counter variable with a test for whether a link row is returned (the last paginated dataset won't have a link row). How would it be best to do that?
Many many thanks for all your help with this 😁
- ImkeF6 years agoCommunity Champion
Hi Anonymous ,
you can use the "brute force" method you used before (try ... otherwise). Otherwise you'd have to split up your statements: https://www.thebiccountant.com/2020/05/15/miss-last-page-paging-power-bi-power-query/
Simply delete the counter statement - that was just for debugging purposes.