Update Variant
This operation allows you to update an existing variant within the catalog.
It follows REST principles and aligns with the OData v4.01 standard.
[PATCH] Variant Endpoint
https://api2.saleslayer.com/rest/Catalog/variants({variantId})
Making a request
- Use the HTTP method: PATCH.
- Include the API key in the request headers for authentication.
- The body must be sent in JSON format with valid identifiers for each field
- The variantId parameter is mandatory. Identifier of the product to be updated.
Request body example:
{
"prod_id": 27,
"frmt_stat": "V",
"frmt_image": "variant_blue_color.png",
"frmt_description": {
"es": "Variante color azul del producto",
"en": "Blue color variant of the product"
}
}
ℹ️You can update one or more variant fields in the same request.
Response
🟢 204 No content
The variant was successfully updated. No additional content is returned.
🔴 400 Bad Request
Common errors include:
- Incorrect JSON format.
- Invalid or missing fields.
- Field values that do not meet constraints.
"prod_id does not exist or is invalid"
🔴 401 Unauthorized
Missing or invalid API key.
🔴 403 Forbidden
The user does not have permission to perform this operation.
🔴 404 Not Found
The product specified in varianttId
does not exist.
🔴 412 Precondition Failed
System is not in a valid state to perform the operation.
🔴 500 Internal Server Error
Unexpected system failure
Limitations and considerations
- Only one variant per call can be updated.
- You must provide a valid, existing
variantId
. - Batch updates are not supported.
- Files and images must already exist in the library.
- It's not possible to associate more than one product per variant.
- All changes made are automatically recorded in the activity log (activity).
Multi-language fields support
You can include multilingual values for attributes that are configured to support multiple languages.
Multilingual body example:
{
"frmt_description": {
"es": "Variante de camiseta roja talla L",
"en": "Red T-shirt variant size L"
},
"frmt_title": {
"es": "Camiseta Roja L",
"en": "Red T-Shirt L"
}
}
📝Make sure the attribute supports multiple languages and that the languages are enabled in your account.
Multilingual field conditions
You can send multilingual values for fields only if:
- The field is defined as multilingual in the attribute set.
- The languages used are supported by your account.
Common errors:
- Unsupported language →
400 - Invalid language code
- Non-multilingual field →
400 - Attribute does not support multi-language