Sort options

A sort option defines how items in a result set can be ordered. It specifies the criteria used to sort the items, such as price or date or any other relevant property. Sort options can order items in ascending or descending order based on the specified property.

For example, it may be beneficial to offer users the ability to sort products from lowest to highest price (ascending) or from highest to lowest price (descending). It is also possible to allow sorting by the date products were added to the catalog, brand names alphabetically, or a custom relevance score.

Sort options help users navigate through and make sense of large sets of results. They enhance the user experience by providing a more organized and tailored way to view the data.

API endpoints

Creating new sort options

Every sort option is identified by the combination of the sort_by and sort_order fields, meaning that there can only be only one sort option with a certain sort_by and sort_order field. For instance, there can only be one sort option that has sort_by=price and sort_order="ascending".

At any time, there can be at most 50 sorting options for a given index key. If the maximum number of sorting options have been reached for an index key and a request to create another sort option has been issued, a response with an appropriate error message and code will be created.