Commerce Layer will be proud to sponsor the next JAMstack Conf in London — 09-10 July, 2019 🎉 Stay tuned!

API REFERENCE

Sorting results

When you fetch a collection of resources, you can request a specific sort for the results. For example, the following request fetches a collection of SKUs sorted by their creation date (descending) and code.

GET /api/skus/1234?sort=-created_at,code HTTP/1.1
Accept: application/vnd.api+json

The value of the sort parameter must be a comma-separated list of fields. The sort order for each field is ascending unless prefixed with a - (minus) in which case it's descending. By default, the API sorts ascending on the id of the primary resource.

Note: You can get the full list of sortable attributes from the documentation of each resource.