Home

Pagination, Filtering, Sorting

The API supports pagination, filtering, and sorting to provide a flexible way to retrieve data in an optimized and structured manner. These parameters are passed through HTTP query parameters in the following format:

{
  "pagination": <Object>,
  "filters": <Object>,
  "sorting": <Object>
}

PaginationCopied!

Pagination allows you to control the number of records returned in response to a query. To manage the number of records returned, use the following pagination parameters:

  • page: The page number to start retrieving records. The default page is 0

  • size: The number of records per page. The default size is 10 and can reach up to 20

For example:

GET /products?pagination[page]=0&pagination[size]=10

In this example, the API will return 10 products (size = 10) starting from the first page (page = 0).

FilteringCopied!

Filtering enables you to refine the data returned based on specific criteria. Each filter is passed as a key-value pair, where the key represents the attribute you want to filter by, and the value specifies the filter criteria. The available filter attributes depend on the resource being queried.

To apply filters, use the following parameters within the filters object:

  • {key}: The attribute to filter the records

  • {value}: The value that the attribute should match

For example:

GET /products?filters[productType]=tour

In this example, the API will return the products that the attribute productType is equal to "tour".

SortingCopied!

Sorting allows you to order the data returned based on specific attributes. Each sorting rule is passed as a key-value pair, where the key represents the attribute to sort by, and the value specifies the sort order (ASC for ascending or DESC for descending).

To apply sorting, use the following parameters within the sorting object:

  • {key}: The attribute by which to sort the records

  • {value}: The sort order, either "ASC" for ascending or "DESC" for descending

For example:

GET /bookings?sorting[createdAt]=ASC

In this example, the API will return the bookings sorted by createdAt in ascending order.