Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Have you ever used Paginated APIs in Power Query to import data? If you have, I have a challenge for you. One of my friends asked me this question, but I couldn’t help him. So, I’m reaching out to my network to find the answer.
He wants to add all the tasks based on each list id (lists.id). So, we need to send each list.id to the API to get the tasks.
#"Added Custom Task" = Table.AddColumn(#"Removed Other Columns4" , "Custom", each Json.Document(Web.Contents("https://lnkd.in/gGDzdEbX"&[lists.id]&"/task?archived=false",[Headers=headers,Query = [archived = "false"]]))),
#"Expanded Custom4" = Table.ExpandRecordColumn(#"Added Custom Task", "Custom", {"tasks", "last_page"}, {"tasks", "last_page"}),
However, some of the lists, like the first row, may have more than 100 tasks. So, their last_page value is FALSE.
He needs to add another row with the same data, but for the second, third... page for each list that has more than 100 tasks.
We tried a nested loop by using List.generate, but no luck.
Our other friend ChatGPT was not able to help either.
So I’m hoping my human network can help me with the answer
There are plenty of examples on the interwabs for paging through API resposes either via "next page" links or with offset. You can decide between List.Generate and List.Accumulate, depending on the expected amount of data (but also keeping in mind that the browser cache will help).
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)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |