In our Catalog, specifications are created in the category level. Products and SKUs inherit their specifications from the category they are placed in and all its parent categories. This may lead to some confusion when using our API to create and update SKUs.
In this article, we share a few tips to help you update an SKU Specification.
SKU and its Specification
First, you need to select an SKU and its Specification to update. If you don’t know the Specifications of the SKU, use the Get SKU Specifications endpoint. It will retrieve all Specifications indexed on the SKU.
In the example below, we show what the response would look like if your SKU had two specifications to fill in:
- Color (
"FieldId": 271
) - Size (
"FieldId": 40
)
If needed, you would be able to get more information about each specification using the Get Specification Field endpoint.
_16[_16 {_16 "Id": 472,_16 "SkuId": 17784,_16 "FieldId": 271,_16 "FieldValueId": null,_16 "Text": ""_16 },_16 {_16 "Id": 528,_16 "SkuId": 17784,_16 "FieldId": 40,_16 "FieldValueId": 147,_16 "Text": "L"_16 }_16]
Notice that the response body from this endpoint is an array but you can’t update all at once. You can update only one SKU Specification at a time.
Knowing the FieldValueId
After selecting the one Specification to update, use the Get Specifications Values By Field Id endpoint. It allows you to know all the possible values from this Specification as you can only update the FieldValueId
from an SKU Specification.
In the example below, we show what the response would look like if your specification had three possible values:
- S (
"FieldValueId": 144
) - M (
"FieldValueId": 145
) - L (
"FieldValueId": 146
)
_20[_20 {_20 "FieldValueId": 144,_20 "Value": "S",_20 "IsActive": true,_20 "Position": 1_20 },_20 {_20 "FieldValueId": 145,_20 "Value": "M",_20 "IsActive": true,_20 "Position": 2_20 },_20 {_20 "FieldValueId": 147,_20 "Value": "L",_20 "IsActive": true,_20 "Position": 3_20 }_20]
Updating the SKU Specification FieldValueId
Finally, use the Update SKU Specification endpoint to change the FieldValueId
from the SKU Specification to the desired new value.
SKU Specifications can only have the
FieldType
as5
(Combo) or6
(Radio). You cannot change theText
field without updating theFieldValueId
. After this update, theText
field will be automatically modified.