Sorting

Sort results that are returned from the API by using the sort parameter with the field name you wish to sort against.

To reverse the sort order, prepend the field with a minus.

Currently, sorting is supported for the following endpoints, and against the following fields:

You can not sort by created_at or updated_at if you are using filtering.

The example below shows how to make a request to get all products, and sort them by the created_at timestamp.

Sort products by created_at ASC

curl -X GET https://api.moltin.com/v2/products?sort=created_at
     -H "Authorization: Bearer XXXX"

Sort products by created_at DESC

curl -X GET https://api.moltin.com/v2/products?sort=-created_at
     -H "Authorization: Bearer XXXX"

Last updated