Forum Discussion
Looping API (total results not available)
Please see this video for another way to approach this. If you API support offset or skip in your web call, you can leverage that after value and dynamically generate a list of numbers with the right spacing for the right number of calls.
Power BI - Tales From The Front - REST APIs - YouTube
Pat
Thanks mahoneypat , your video was perfect for the previous API I was working with where I got the total number of rows available.
In the current API the pagination part of the call return only gives me the following.
after: the ID of the last result in the current call
link: full link of the next call, skipping all rows in the current call (&after=32401)
Also worth mentioning, the ID is not sequential. The next ID might be 33551, i.e. its not 32402.
Any hints?
Wes
- mahoneypat4 years agoMicrosoft Employee
If you know approximately how many to expect, you could make a list of numbers to use as your "after" values that intentionally goes just past it and then remove any rows where you get error instead of "Table". That would be simpler than a recursive solution.
Pat