Environment:
Skip to main content
This documentation is in BETA version, for any information contact us at api@sibill.it

Sort Results

The Sibill APIs support sorting results by specific fields in the responses. Each resource defines a set of fields on which sorting can be performed.

How to use it

The fields by which you want to sort must be passed in the query string in the following form:

sort=field_name or sort=-field_name

If the field name is preceded by a - (minus sign), the sort order will be descending. Otherwise, the sort order will be ascending (default).

Example using the API with ascending sort:

GET /api/v1/companies/:company_id/documents?sort="creation_date"

The above call will retrieve all documents and sort them by creation date in ascending order.

Example using the API with descending sort:

GET /api/v1/companies/:company_id/documents?sort="-creation_date"

In this case, documents will be sorted so that the most recent ones appear at the top of the list.

Example using the API with multi-field sort:

GET /api/v1/companies/:company_id/documents?sort="-creation_date,number"

In this case, documents will be sorted by creation_date first and then by number.