Forum Discussion

rtmst101's avatar
rtmst101
New Member
6 years ago

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:
itemslist
continuation_token2020-03-02T01:03:24.000Z

Else "continuation_token" is "null" if all records have been returned.
itemslist
continuation_tokennull

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