Pagination, Sorting & Filtering
All list
type API methods support a few functions to help prepare or navigate the list. These functions are:
- Pagination
- Sorting
- Filtering
Pagination
To do pagination, you will need to set these variables.
Page size | Page number |
---|---|
Number of objects to be returned in a page. Default page size is 10 and max page size is 1000. | The page number you want returned. |
When you make the API call, include page[size]=
and page[number]=
to set the variables above.
GET api/v4/payments?page[number]=3&page[size]=100
Sorting
Sorting allows you to sort lists according to one or more criteria fields, for example, you might want to sort based on the createdAt
date time. To sort, pass in a ?sort=
as part of the call.
The sort order for each sort field is ascending by default. If you need to sort by descending, prefix the sort field parameter with a minus.
See the example below, where we want to list disbursements
with the latest disbursements shown first.
GET api/v4/disbursements?sort=-createdAt
Filtering
Each list type API method will have its own specific filtering methods. Please find their filtering methods in the specific API sections. Here is an example of how to filter a list response:
GET api/v4/disbursements?filter[createdAfter]=2020-08-18T15:38:12+08:00
For listing of payments
and disbursements
, these are the filters you can use:
Filter Name | Filter By |
---|---|
createdAfter | Time.iso8601 |
createdBefore | Time.iso8601 |
status | String Disbursement Statuses: 'processing', 'completed', or 'failed' Payment Statuses: "paid", "completed" |
referenceId | String |
Updated about 2 years ago