Enable Pagination


You can configure an API flow to paginate response data from the Response object.

Pagination is a process that is used to divide large data into smaller discrete pages, thus allowing for less clutter and better readability. It also means that server request processing will be faster as a small subset is to be returned. Hence, improving the overall API performance and readability.

For our use case, we have an API flow that is configured to retrieve a collection of order items using a database lookup along with filter and sort functionalities enabled. Now, let us see how pagination can be configured in this flow.

  1. Right-click on the Response object and select Properties from the context menu.

This will open the Properties window.

  1. Click Next until you reach the Response Configuration window.

This is where you can set up pagination options to better structure the response data fetched for a successful 200-OK request.

Enable Cursor Pagination: Checking this box lets the incoming data be paginated by a cursor. Cursor-based pagination works by returning a pointer to the last item in the dataset page, using which the client can make successive requests to read the next set of records iteratively. Once all records have been read, the cursor value becomes null, thus indicating that no more records are left to be read.

Page Size: This counter determines the number of records returned in a single requested page.

  1. Click OK and the Response object will be configured in accordance with the cursor pagination and page size.

Note: Any request made to this endpoint will return the first n (page size) records along with a ‘cursor’ field in the response payload. This cursor field can then be reiterated in the next request as a Query Parameter named ‘Cursor’ to fetch the next n (page size) records.

At runtime, these paginated calls are cached on the server. To learn more about it, click here.

Last updated

© Copyright 2023, Astera Software