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/
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
etc
Then 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
etc
I 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.
The mechanics for this type of paging are described in the article I linked to.