Pagination and Sorting
How to paginate and sort data using the PortierX API.
Work in progress
We are actively working on our API. The documentation and implementation described here may not yet be fully aligned.
Pagination
Pagination is controlled via query string parameters:
- The
pageparameter specifies which page of results to retrieve. - The
limitparameter defines the number of results per page (maximum allowed is 100).
Pagination and sorting apply only to list requests. The default page is 1, and the default limit is 10.
Example Response with Pagination
Metadata Explanation
| Field | Description |
|---|---|
total | The total number of available records. |
count | The number of records returned in the current response. |
per_page | The number of records per page. |
current_page | The current page number. |
total_pages | The total number of pages available. |
Sorting
Sorting is done using the order query string parameter. By default, sorting is based in creation date ascending (oldest to newest / smaller to larger). It accepts a comma-separated list of fields and directions.
Sorting Example
age.descsorts theagefield in descending order.height.ascsorts theheightfield in ascending order.
Default Sorting
If no direction is specified, the default order is ascending:
Null Handling
To control the sorting of null values, use nullsfirst or nullslast:
This ensures predictable ordering when dealing with null values. By default, null values are sorted last.