Sorts

Sorting allows you to order multiple API results by a specific attribute or criteria.

When making API calls that return multiple resources, you may want the returned list of resources sorted to a specific attribute or criteria. To achieve this, you can use a sort query parameter in your GET requests.

Syntax

To utilize sorting correctly, the sort parameter must be included as a query parameter in your requests. A request can only have a single sort query parameter with a single value for it. If a sort value is prefixed with a dash -, this will sort your resources on that attribute in descending order rather than ascending.

GET : /api/v1/projects?sort=name would return a listing of projects sorted by their name in ascending order.

GET : /api/v1/projects?sort=-name would return a listing of projects sorted by their name in descending order.

To determine what attributes are sortable for a specific resource, consult the "Allowed sorts" section in the Types documentation for your specific resource.