Updating Variation
Endpoint: PUT /admin/variations/{variation_id}
Purpose
The PUT/admin/variations/{variation_id}
allows administrators to update an existing variation by its unique ID. It supports modifying the variation's name, standard type, disposability status, and associated options. This is useful for maintaining accuracy and relevance when managing variation data.
Path Parameters
Parameter | Type | Description |
---|---|---|
variation_id | Integer | The unique ID of the variation to update. |
Query Parameters
No query parameters for this endpoint.
Use Case
Administrators use this endpoint to edit existing variations. For instance, updating a variation name, changing the order of options, or setting a default option. This ensures that the system always reflects the latest and correct variation configurations.
Request Body
Parameter | Type | Description |
---|---|---|
name | String | The name of the variation. |
standard | String | The type of input for the variation (text). |
is_disposable | Boolean | Indicates whether the variation can be discarded after use. |
options | Array | A list of variation options. |
{
"variation": {
"name": "VARIATION_NAME",
"standard": "VARIATION_STANDARD",
"is_disposable": "VARIATION_IS_DISPOSABLE",
"options": [
{
"id": "VARIATION_OPTION_ID",
"label": "VARIATION_OPTION_LABEL",
"value": "VARIATION_OPTION_VALUE",
"order": "VARIATION_OPTION_ORDER",
"default": "VARIATION_OPTION_DEFAULT"
}
]
}
}
Response
The response delivers the updated variation object with all associated properties, including the variation ID, name, standard type, and disposability flag. The options array reflects the current list of variation choices, each containing identifiers, labels, values, default status, order, and image placeholders. This ensures the client application is synchronized with the updated variation configuration, enabling accurate product management and display of variations on the storefront.
{
"variation": {
"id": "VARIATION_ID",
"name": "VARIATION_NAME",
"standard": "VARIATION_STANDARD",
"is_disposable": "VARIATION_IS_DISPOSABLE",
"options": [
{
"id": "VARIATION_OPTION_ID",
"label": "VARIATION_OPTION_LABEL",
"value": "VARIATION_OPTION_VALUE",
"order": "VARIATION_OPTION_ORDER",
"default": "VARIATION_OPTION_DEFAULT",
"image": "VARIATION_OPTION_IMAGE"
}
]
}
}