title: Iterating REST API with date parameter in Power BI using Power Query
body: <p>I am new to Power BI and power query and want to iterate over a REST API to fetch records with data parameters historically. REST API takes a &quot;changedAfter&quot; parameter and returns 10,000 rows at a time in JSON format. How can I iterate with an input parameter &quot;changedAfter&quot; to fetch records until current_date in Power query? I can do a while loop easily in Python but new to to power query.</p>
  <p>dummy url - https://html/abcd/xyz?changedAfter=2021-07-01</p>
  <p>pseudo-code would look like-</p>
  <pre><code>#Declare variables
  changed_after = &quot;2021-07-01&quot;
  current_date as systemdate
  table = []
  
  while (Max(table[changed_after]) &gt;= current_date) # check Max of change_after date from fetched rows with current system date.
  do
  changed_after_text = date.text(&quot;changed_after&quot;) # convert date to text for URL.
  table = table + https://html/abcd/xyz?changedAfter=[changed_after_text] #append upto 10,000 rows to a table.
  changed_after = Max(table[changed_after]) + 1Day # increment earliest date from fetched rows by one day.
  
  Break
  </code></pre>