Pagination allows you to organize the elements returned in the API response into manageable portions. This also helps you control the network traffic.
Hevo utilizes cursor-based pagination via the starting_after
and limit
parameters to return a list of elements. The starting_after
parameter serves as a unique identifier for the last record that was returned and helps identify the next set of records to be returned in the next page of the response.
Request Parameters
Name | Data Type | Description |
---|---|---|
starting_after | string | A cursor for use in pagination. starting_after defines the position of the last record read in the list. For instance, if you request a list and receive 20 elements along with a cursor value of xyz, your subsequent call must include starting_after=xyz in order to fetch the next page of records. |
limit | number | The maximum number of elements to be returned in each page of the API response. Minimum value: 1, maximum value: 100. |
Sample request with pagination
To paginate the response, add the parameter limit=<value>
to the request.
curl --request GET \
--url 'https://asia.hevodata.com/api/public/v2.0/pipelines?limit=20' \
--header 'Accept: application/json' \
--header 'Authorization: Basic VFlZPK3SV1pJTTpJcENJVEU0QzkramRwNmNRT1VLEQ=='
List Response Format
Property | Data Type | Description |
---|---|---|
pagination | object | An object containing meta data related to pagination. If there are no more elements available after the current set, pagination object is not returned. |
pagination.starting_after | string | The cursor used to identify the record to start fetching results from, for the next page of results. |
pagination.count | number | The number of records returned in this page. |
data | array | An array of the actual response elements, paginated by any request parameters. |
Sample response with pagination
The starting_after
token is auto-generated by Hevo.
Suppose, there are 100 Pipelines, and you fetched the first 20 using the parameter, limit=20
, as shown in the sample request code snippet above. In the API response, you receive a starting_after
token, as shown in the sample response above.
Now, to fetch the next 20 Pipelines, you must send this token back to the server using the parameter,starting_after
and value, MzMwMg==
to help the server identify where to resume from. The API request would then appear as:
curl --request GET \
--url 'https://asia.hevodata.com/api/public/v2.0/pipelines?starting_after=MzMwMg==&limit=20' \
--header 'Accept: application/json' \
--header 'Authorization: Basic VFlZPK3SV1pJTTpJcENJVEU0QzkramRwNmNRT1VLEQ=='
If the pagination
object is not returned in the response, it means that there are no more pages to be fetched. The API has returned all the data.