Guides
Guides
Guides

Pagination, filtering and Sorting

Pagination

Some of our endpoints allow pagination. To use this feature, add queryParams after the endpoint as follows:

{{endpoint-to-be-paginated}}?page={{page}}&size={{size}}

Filtering

Some of our resources have filters enabled. This feature lets you refine searches in our getAll endpoints.

It's possible to filter search results by any field inside the relevant objects. To do so, add filterEq and/or filterOr after the endpoints:

{{endpoint-to-be-filtered}}?filterEq={{filterEq}}&filterOr={{filterOr}}.

The filterEq or filterOr should be built using the following structure:

filterEq=person.firstName:Anthony,person.lastName:Jhonson

Our API will get the field name and the value to use as filter parameters.

curl --request GET \
     --url https://sandbox.api.caliza.co/core-api/v1/beneficiaries?filterEq=person.firstName:Anthony,person.lastName:Jhonson \
     --header 'Authorization: Bearer {{your_token}}'
curl --request GET \
     --url https://sandbox.api.caliza.co/core-api/v1/beneficiaries?filterOr=person.firstName:Anthony,person.idNumber:98767676 \
     --header 'Authorization: Bearer {{your_token}}'

Sorting

The endpoint that allow pagination, can allow sort as well. In order to paginate it you should just add a new request param named sort. This field format looks like this:

{{endpoint-to-be-paginated}}?sort=name,asc

{{endpoint-to-be-paginated}}?sort=name,desc

Sorting allow many fields:

{{endpoint-to-be-paginated}}?sort=name,desc&sort=age,asc