ApiSkills

Power Automate · 8 min

Power Automate: pagination (Do Until)

When using the raw HTTP action, loop with Do Until following nextLink until it is empty.

The HTTP action only auto-paginates for OData APIs (@odata.nextLink). Ours returns nextLink, so with the raw HTTP action you build the loop yourself. (The custom connector does this automatically.)

  1. Initialize string NextUrl = https://api.ifsjaipur.cloud/playground/data/stocks/candles?shape=flat&paginate=cursor&page_size=50
  2. Initialize array Rows = []
  3. Do Until NextUrl is empty: HTTP GET NextUrl → Parse JSON → Append body/data to Rows → Set NextUrl = body/nextLink
  4. After the loop, Rows holds every record; write it to Excel / Dataverse / a table.

Tip · body/nextLink is empty on the last page, which ends the Do Until cleanly. Add a safety cap on the loop count for peace of mind.