Pagination is a feature of our API that you can use to handle responses that contain large datasets, for example, when you retrieve a list of payments.
Instead of returning all the results in one response, we separate the results into pages and return a page for each request. You can then send follow-up requests to retrieve the other pages.
Request parameters
If a method supports pagination, you can use the following query parameters to tailor your results:
- before - Return results that are before the value that you specify. You can't use the before parameter in the same request as the after parameter.
- after - Return results that are after the value that you specify. You can't use the after parameter in the same request as the before parameter.
- limit - Specify the maximum number of results we return for each page. If you don't include a limit parameter, we return a maximum of 10 results for each page.
Note: To retrieve the first page of results, don't include a before parameter or an after parameter in your request.
Example request
The following example is a request to our List Contacts method. The request limits the results for each page to two results:
curl -G https://api.payroc.com/v1/processing-accounts/38765/contacts \
-H "Authorization: Bearer <token>" \
-d limit=2
Response fields
We return the following fields in the response:
- limit - Maximum number of results that a page can contain.
- count - Number of results that we returned in the page.
- hasMore - Boolean that indicates if there are more results available. If the value is
false, you have reached the last page of results. - data - Array that contains your results.
- links - HATEOAS object that contains information about how to navigate to additional pages of results. The object contains the following fields:
- rel - Relationship of the link to the current page. The value is one of the following:
next- Next page of results.previous– Previous page of results.
- method - HTTP method that you use to retrieve the next page or previous page of results.
- href - Uniform Resource Identifier (URI) of the next page or previous page.
- rel - Relationship of the link to the current page. The value is one of the following:
Example response
The following example is a response from our List Contacts method. The response contains two results, along with a links object that contains a URI to the next page of results.
{
"limit": 2,
"count": 2,
"hasMore": true,
"links": [
{
"rel": "next",
"method": "get",
"href": "https://api.payroc.com/v1/processing-accounts/38765/contacts?after=87926&limit=2"
}
],
"data": [
{
"contactId": 87925,
"type": "manager",
"firstName": "Jane",
"lastName": "Doe",
"identifiers": [
{
"type": "nationalId",
"value": "xxxxx4320"
}
],
"contactMethods": [
{
"type": "email",
"value": "jane.doe@example.com"
}
],
},
{
"contactId": 87926,
"type": "representative",
"firstName": "Fred",
"lastName": "Nerk",
"identifiers": [
{
"type": "nationalId",
"value": "xxxxx9876"
}
],
"contactMethods": [
{
"type": "email",
"value": "fred.nerk@example.com"
}
],
}
]
}