Skip to content

Reorder an attribute's values

PUT
/stores/{storeRef}/attributes/{attributeId}/values/reorder
curl --request PUT \
--url https://apibase.ecomweb.app/api/v1/stores/example/attributes/1/values/reorder \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "order": [ { "id": 1, "sort_order": 0 } ] }'

Sets the sort_order of each listed value, which controls the order of the attribute’s values. IDs that do not belong to the attribute are ignored. The response has an empty body.

Required scopes: write:products

attributeId
required
integer

The attribute ID.

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
order
required
Array<object>
object
id
required

Attribute or value ID

number

Example

1
sort_order
required

New sort order

number

Example

0

The new order was saved.

Media typeapplication/json

The response body is empty.

string
0

Example generated

example

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}