Pagination

Pagination refers to managing the traffic of records coming from a source. It divides the records into a discrete number of pages so that they are comprehensible for a user.

Pagination is not supported by all APIs. For those that do support it, Astera offers four types of paginations.

Offset

This type of pagination requires two parameters: A Limit and an Offset value to be specified by the user. A Limit specifies the number of records that you want to fetch in a one-page request, and an Offset simply tells the number of records to be skipped before selecting records.

  • Offset Parameter: Select the offset parameter of the API that you are working with, as specified on the Parameters screen.

  • Initial Offset: The record index from which you want to start your pagination.

  • Limit Parameter: Select the limit parameter of the API that you are working with, as specified on the Parameters screen.

  • Limit: Number of records on a one-page request.

  • Number of Pages: The number of pages indicates the number of request iterations which you want to be processed. Each iterative request incrementally adds the respective offset and limit values for the next set of records page.

  • Read Till End: Check this option if you want to fetch all the records. Selecting this will disable the ‘Number of pages’ option and all the records will be returned as requests are sent in a loop till no more data is found.

  • Repeating Item: This option is only enabled when you check the Read till end box. You can choose a repeating item or the collection node of the data from the output layout of the API client object. The repeating item helps the API client recognize the end of records, as whenever an empty response node is returned, the client stops sending further requests, and pagination ends.

Cursor

This type of pagination generates a token to indicate a pointer for the next page of records. You can set a limit to the number of pages you want to process.

  • Cursor Field: Here, you can specify the field from the output layout which contains the cursor from the server response.

  • Cursor Parameter: Here, you can select the parameter to be used to send the cursor value received in the previous request of the API that you are working with, as specified on the Parameters screen. Alternatively, you can choose to send the cursor as an input body layout field by selecting the ‘Use Input Body Parameters’ checkbox.

  • Number of Pages: Here, you can specify the number of pages or the number of requests to be made iterating over the data set. Additionally, you can simply check the Read till End option if you want to fetch all records without specifying the number of pages.

Next URL

This type is the same as Cursor pagination, except that it generates a URL instead of a token for every subsequent page.

  • Next URL Field: Here, you can specify the field from the response layout that contains the URl to fetch the next set of records.

  • Number of Pages: Here, you can specify the number of pages or requests you want to fetch, or you can simply check the Read Till End option if you want to fetch all records without specifying a page number limit.

Page Number

In this type of pagination, you can specify the number of pages you would like to fetch in one go.

  • Page Number Parameter: Here, you can specify the page number parameter of the API that you are working with, as specified on the Parameters screen.

  • Start Page Number: The page number from where you want to start fetching your output, or the lower limit.

  • End Page Number: The page number where you want to end.

  • Read till end: Check this option if you want to fetch all the available records. Selecting this will disable the End page number option and make requests till no data is returned.

  • Repeating item: This option is only enabled when you check the Read till end box. You will be required to choose a repeating item, which can be one of the collection nodes from the output layout of the API client object. The repeating item helps the API client recognize the end of records, as whenever an empty response node is returned, the client stops reading the response and the pagination ends.

This concludes our discussion of pagination for APIs in Astera.

Last updated

© Copyright 2023, Astera Software