We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 7 | |
| 6 | |
| 5 |