Pagination, Sorting & Filtering

All list type API methods support a few functions to help prepare or navigate the list. These functions are:

  1. Pagination
  2. Sorting
  3. Filtering

Pagination

To do pagination, you will need to set these variables.

Page sizePage 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 timestamps, please note that when you send the request, the timestamp should be url-encoded like this:

GET api/v4/disbursements?filter[createdAfter]=2020-08-18T15%3A38%3A12%2B08%3A00

For listing of payments and disbursements, these are the filters you can use:

Filter NameTypeDescription
createdAftertimestampState the time in Time.iso8601
createdBeforetimestampState the time in Time.iso8601
statusstringDisbursement Statuses: 'processing', 'completed', or 'failed'

Payment Statuses: "paid", "completed"
referenceIdstringState the specific referenceId if any.