Story-based pagination gives you complete control over the pagination logic by building it manually using actions and triggers. This approach is useful when you need custom logic, want to add delays between requests, or need to transform data between pages.
The core pagination loop
At its heart, pagination via story build is about creating a loop. Make a request, check if there are more pages, and if so, make another request. This loop continues until you've retrieved all the data.
Here's the basic flow:
Make the initial request: Use an HTTP Request action to call the API endpoint.
Check for more pages: Use a Trigger action to evaluate whether additional pages exist.
Insert delays: Utilize the delay mode of the Event Transform action to avoid API rate limiting.
Make subsequent requests: If more pages exist, loop back to make another request.
End the loop: When no more pages remain, exit the loop and process the collected data.
Let's walk through an example of building pagination logic within a story.
🖐️ Try this: Paginate example via story build
Handle pagination results
Once you've retrieved multiple pages of data, you need to decide how to process them. Tines gives you two main approaches: exploding results to process each item individually, or merging results to work with the complete dataset at once.
Explode pagination results
Exploding pagination results allows you to process each individual item from all pages separately, which is useful when you need to enrich, transform, or take action on each record independently.
🖐️ Try this: Explode pagination results
Merge pagination results
Merging pagination results combines all pages into a single array, which is useful when you need to work with the complete dataset at once, such as generating a report or performing aggregate analysis.