Forum Discussion
rtmst101
6 years agoNew Member
Create Loop-While query for Continuation Token
Hi Guys,
I'm a novice in Power BI and need help with creating a Rest API loop while query if "continuation_token" is present.
Current API Query:
= Json.Document(Web.Contents("http-url/endpoint?&fromDatetime=2020-03-01T10:00:00.000Z&toDatetime=2020-03-02T10:00:00.000Z"))
If query record limit is reached during Get query, a "continuation_token" datetime value is returned as follows:
| items | list |
| continuation_token | 2020-03-02T01:03:24.000Z |
Else "continuation_token" is "null" if all records have been returned.
| items | list |
| continuation_token | null |
I need a loop while query that will replace the "fromdatetime" in the Web.Contents() function while "continuation_token" is not "null".
I believe my solution will require use of List.Generate() function but I haven't been able find a example for my context.
Many Thanks in Advance.
2 Replies
- parry2kSuper User
- v-yingjlCommunity Support
Hi rtmst101 ,
If you want to use List.Generate, you can refer the following example articles that could help you:
- List.Generate()
- https://docs.microsoft.com/en-us/powerquery-m/list-generate
- https://powerpivotpro.com/2016/02/reviewlist-generate-create-tables-thin-air-power-bi-m/
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.