v1

latestOpenAPI 3.1.02026-07-241765501.1 MB
Sort options

Replace a sort option

🔐 This endpoint requires HTTP authentication (either Basic or Bearer). For authenticating with Bearer token, required scopes are: sort_options(w).

Replace a sort option. If the sort option already exists, it will be updated, if not it will be created. Note that total number of sort options is limited, and every combination of sort_by and sort_order fields among the sort options must be unique.

put/v1/sort_option/{sort_by}/{sort_order}

Path parameters

sort_bystring required
sort_orderstring required

Query parameters

keystring required

The key of the index to use.

Example:key_K2pX7vBnU0bgA5xp
sectionstring

The section of the index to use. Defaults to Products.

Example:Products
cstring

The ID of the client and version that the request is coming from, such as cio-js-2.90.

Example:cio-js-2.90

Request body

display_namestring

The name of the sort option as it is displayed to end users.

path_in_metadatastring

The path in the item's metadata to the field that results will be sorted according to.

positioninteger

The position of the sort option, used to provide sort options in a specific order.

hiddenboolean

Indicates if a sort option is hidden. This can be marked at sort_by level. A hidden sort option will be ignored in response by default.

Example request

{
  "display_name": "Price: Low to High",
  "path_in_metadata": "data.price",
  "position": 1
}

Response

OK

display_namestring required

The name of the sort option as it is displayed to end users.

path_in_metadatastring required

The path in the item's metadata to the field that results will be sorted according to.

positioninteger

The position of the sort option, used to provide sort options in a specific order.

hiddenboolean

Indicates if a sort option is hidden. This can be marked at sort_by level. A hidden sort option will be ignored in response by default.

sort_bystring required

The name of the sort option.

sort_order'ascending' | 'descending' required

Example response

{
  "display_name": "Price: Low to High",
  "path_in_metadata": "data.price",
  "position": 1,
  "sort_by": "price"
}