Forum Discussion
Help applying Query and Relative path to avoid dynamic data source for Service refresh
The best option would be if your initial API call would return the number of pages (bookmarks). That would allow you to generate a list of URLs, call for each URL's content, and then concatenate them, all in one go.
If you don't have that I would use a recursive function that keeps calling itself (and accumulating the returned data) until the bookmark stops changing.
Recursive Functions in Power BI / Power Query — Powered Solutions
Hi Ibendlin.
I cannot go with the first option as the number of bookmarks are unknown before hand.
The section of the code below, runs the function to make an API call, update the bookmark and then make another call untill the number of iterations reaches the set limit. I still need to figure out how to set it to stop when bookmarks don't change. Its there just badly coded.
GeneratedList =
List.Generate(
() => [i=0, res = FnGetOnePage(url)],
each [i] < iterations,
each [i=[i]+1, Bookmark1 = [res][Bookmark], res = FnGetOnePage(url)],
each [res][Data]
),