Sort results that the API returns by using the sort parameter with the field name you will sort against.

🚧

Note

Multiple sort parameters are supported.

Examples

Example: Sort products by Name in ascending order.

In the following example, we request all products by name, sorted in ascending alphabetical order.

curl --request GET \
     --url 'https://rlp-dev.congacloud.io/api/v1/products?page=1&limit=100&sort=asc(Name)' \
     --header 'Accept: application/json'

Example: Sort products by CreatedDate in descending order.

In the following example, we request all products by their created date, sorted in descending chronological order.

curl --request GET \
     --url 'https://rlp-dev.congacloud.io/api/v1/products?page=1&limit=100&sort=desc(CreatedDate)' \
     --header 'Accept: application/json'

Example: Sort categories first by Name in ascending order, then by ProductCount in ascending order

In the following example, we request all categories, sorted first by name and then by product count, in ascending order.

curl --request GET \
     --url 'https://rlp-dev.congacloud.io/api/v1/categories?page=1&limit=100&sort=asc(Name)&sort=asc(ProductCount)' \
     --header 'Accept: application/json'