Forum Discussion
API max pages
- 2 years ago
Yes, problem solved. Thanks to this article.
https://datachant.com/2016/06/27/cursor-based-pagination-power-query/
lbendlin ; I read the article, but I just don't know how to paste or create a new table.generateByPage in my table or advanced editor.
Can you help me with this?
That's just a convenience function, you don't need to use it verbatim.
As you can probably appreciate it is nearly impossible to help with API queries without access to said API (which you may not be willing to provide for understandable reasons)
- Tinus19052 years agoResolver I
Ok, when I call the API, the url has 20 records. There's a column in this table with "data.next_page_url". In this column the url link is for the second page. When I duplicate this table and change the url in the advanced editor with the url from the column "data.next_page_url", I get new records so that is fine.
To get all the records in 1 table I tried this:
(page as number)=> let Source = Json.Document(Web.Contents("https://webadress"&Number.ToText(page), #"Converted to Table" = Table.FromList(data1, Splitter.SplitByNothing(), null, null, ExtraValues.Error), etc etcThen I created a new table with:
let Source = List.Generate(()=> [result = try #"fLeads (2)"(1) otherwise null, page=1], each [result]<>null, each [result = try #"fLeads (2)"([page]+1) otherwise null, page=[page]+1], each [result]), #"Converted to Record" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), etc etcI get a table with many records, but all the records are from the first url over and over again.
I also tried to change the url link from the "data.next_page_url" but no succes.
- lbendlin2 years agoSuper User
The mechanics for this type of paging are described in the article I linked to.