Sorting
When getting items via the Quantive Results REST API, you can sort the response by any of its properties. Common use cases are to sort the response by creation date, name, or id.
If an endpoint supports sorting, the default sort criteria and available fields to sort by will be specified in the endpoint documentation.
To sort your response, pass a sort query parameter in your request URL and specify the name of the property you want to sort by.
Example:
- To sort a list of Objectives by their created date use:
`GET` https://app.(us./as./sa.)quantive.com/results/api/v2/goals?sort=dateCreated
- If you want to sort the Objectives by Attainment (0-100%), use:
`GET` https://app.(us./as./sa.)quantive.com/results/api/v2/goals?sort=attainment
If you want to sort in reverse order, add a minus sign in front of the property you are sorting by.
Example:
- To sort a list of Objectives by name (A-Z), use:
`GET` https://app.(us./as./sa.)quantive.com/results/api/v2/goals?sort=name
- To sort a list of Objectives by name (Z-A), use:
`GET` https://app.(us./as./sa.)quantive.com/results/api/v2/goals?sort=-name
You can also combine sorts to have one property sorted normally, and the other sorted in reverse.
Example:
- To sort a list of Objectives by created date and reversed names(A-Z), use: https://app.(us./as./sa.)quantive.com/results/api/v2/goals?sort=dateCreated,-name
- In this API call, your Objectives are first sorted by date. Then, the Objectives created on the same date will then be sorted in reverse name order.
Quantive Results API V2 - the above examples for Sorting will work with Quantive Results API V2 for a cleaner response. However, you should always check the specific endpoint documentation to determine V2 compatibility.