Sorting and Pagination

Sorting and pagination are supported for most RocketKOR APIs that return arrays of resources. You can control sorting and pagination through URL query parameters.

Sorting Query Parameters

Use the sort parameter to specify a sort field and an optional sort order (ASC or DESC). For example, the following parameters would sort the results by two fields: first the createdAt field in descending order, then the title field in ascending order.

GET {endpoint}?sort=createdAt,DESC&sort=title,ASC

Pagination Query Parameters

Use the page (page number to return) and size (maximum number of results to return per page) parameters to limit the number of results and keep responses to a reasonable size. For example, to return the first 10 records on the first page, use page=0 and size=10.

The response includes paging information followed by the content array. The following fields are returned:

totalElements  Total number of available elements.
totalPages  Total number of available pages.
number  Page number returned.
numberOfElements  Number of elements returned.
hasNext  Whether additional elements are available after this set.
content  Array of JSON objects, such as accounts or transactions, for the requested page number.

For example:

  "totalElements": 10,
  "totalPages": 1,
  "number": 1,
  "numberOfElements": 10,
  "hasNext": true,
  "content": [
      "id": "6a017f06-83a3-44b7-be6f-5e5cae4a9ed7",
      "businessAccountId": "8th32z87-3845-9810-v7gu-1f827g98swk3",
      "businessRefId": "RECIP001",
      "firstName": "John",
      "middleName": "",
      "lastName": "Smith",
      "secondLastName": "",
      "email": "",
      "phoneNumber": "4161234567",
      "nationality": "Canadian",
      "dateOfBirth": "1970-07-08",
      "additionalInformation": "",
      "recipientType": "INDIVIDUAL",
      "businessName": "",
      "state": "ACTIVE",
      "createdAt": "2021-07-08T20:56:35.219Z",
      "updatedAt": "2021-07-08T20:56:35.219Z",
      "requestorId": "9kj43t32-2956-2886-x7dy-6r821w39kra3"