PAD + CloudData Operationsapipaginationrest

API Pagination Loop

Loops through paginated REST API responses, accumulating all records into a single DataTable until the last page is reached or a safety limit is hit. Supports both cursor-based (nextPageToken / @odata.nextLink) and offset+limit pagination styles.

Members OnlySign in or create a free account to view and copy this pattern.

Usage Notes

  • Set varBaseUrl to your API endpoint without page parameters.
  • For cursor-based APIs (e.g. Graph, Salesforce), use Pattern 1 — the loop reads nextPageToken from each response.
  • For offset/limit APIs (e.g. most REST APIs), use Pattern 2 — increment the offset by the page size each iteration.
  • varMaxPages is a safety guard — set it high enough to cover your largest expected dataset.
  • Pair with DataTable → JSON Array if you need to post the accumulated results to another API.

Requirements

  • Power Automate Desktop 2.30+ or Power Automate Cloud
  • Variables: varBaseUrl (Text), varAccessToken (Text), varAllRecords (DataTable)
  • Actions: Web.InvokeWebService, Variables.ConvertJsonToCustomObject
API Pagination Loop | FlowLibs