API add product feature

I’m trying to change product feature but I’m getting response Error: InternalServerError

PUT /api/products/2513
{
“product_features”: {
“5”: {
“feature_id”: “5”,
“variant_id”: “1496”,
“variants”: {
“1496”: {
“variant_id”: “1496”,
“variant”: “test”
}
}
}
}
}

Here is the feature with variants
{
“feature_id”: “5”,
“feature_code”: “”,
“company_id”: “0”,
“feature_type”: “S”,
“parent_id”: “0”,
“display_on_product”: “Y”,
“display_on_catalog”: “Y”,
“display_on_header”: “Y”,
“description”: “Barva”,
“internal_name”: “Barva”,
“lang_code”: “cs”,
“prefix”: “”,
“suffix”: “”,
“categories_path”: “”,
“full_description”: “”,
“status”: “A”,
“comparison”: “N”,
“position”: “30”,
“purpose”: “group_variation_catalog_item”,
“feature_style”: “dropdown”,
“filter_style”: “checkbox”,
“variants”: {
“1496”: {
“variant_id”: “1496”,
“variant”: “test”,
“description”: null,
“page_title”: “”,
“meta_keywords”: “”,
“meta_description”: “”,
“lang_code”: “cs”,
“feature_id”: “5”,
“url”: “”,
“color”: null,
“position”: “0”,
“seo_name”: null,
“seo_path”: null,
“image_pair”: null
},
“1497”: {
“variant_id”: “1497”,
“variant”: “test1”,
“description”: null,
“page_title”: “”,
“meta_keywords”: “”,
“meta_description”: “”,
“lang_code”: “cs”,
“feature_id”: “5”,
“url”: “”,
“color”: null,
“position”: “0”,
“seo_name”: null,
“seo_path”: null,
“image_pair”: null
}
}
}

Any idea what am I doing wrong?

I found the solution. The manual is incorrect. You must specify feature_type to make it work:

PUT /api/products/2513
{
“product_features”: {
“5”: {
“feature_id”: “5”,
“feature_type”: “S”,
“variant_id”: “1496”,
“variants”: {
“1496”: {
“variant_id”: “1496”,
“variant”: “test”
}
}
}
}
}

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.