Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
rtmst101
New 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:
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 2
v-yingjl
Community Support
Community Support

Hi @rtmst101 ,

If you want to use List.Generate, you can refer the following example articles that could help you:

  1. List.Generate() 
  2. https://docs.microsoft.com/en-us/powerquery-m/list-generate
  3. https://powerpivotpro.com/2016/02/reviewlist-generate-create-tables-thin-air-power-bi-m/

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@rtmst101 check this link 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.