Sorting

Sorting on collections can be performed by adding a ?sortBy=sort-criteria query parameter to the GET operation on the collection:

GET https://api.thirdpartybank.com/transactions/scheduledTransactions?sortBy=createdAt
GET https://api.thirdpartybank.com/transactions/scheduledTransactions?sortBy=-postedAt,title

The sort-criteria are a list of sort keys, expressed as a comma-separated list of properties that exist in the collection’s item schema. The order of properties determine sort priority: with ?sortBy=-postedAt,title, the collection is sorted by postedAt (in descending order), then by the secondary sort key, `title’.

The default is ascending order. The - prefix on a sort key denotes descending order.

Not all properties are allowed in sort criteria; properties which have object or array types are not sortable.

The sortBy property us preserved in the _links embedded in the collection response body.