I have problems in adding values to an existing product attribute, using the API POST /products/attributes/:attribute_id/options
.
The corresponding GET API is working fine, as explained below.
I have defined a drop down product attribute in my store and I am trying to add values using Rest API.
I am able to retrieve the current values of the attribute with this GET call:
http://50.50.50.50/index.php/rest/V1/products/attributes/135/options
And I get, as expected, this result:
[
{
"label": " ",
"value": ""
},
{
"label": "Coffe",
"value": "4"
},
{
"label": "Tea",
"value": "5"
}
]
Then I try to add a new value with this POST call:
http://50.50.50.50/index.php/rest/V1/products/attributes/135/options
Passing the following value:
{
"option": {
"label": "Cappuccino",
"value": "6"
}
}
The response is: true
But if I repeat the first call, in order to get the new list of values, the new value is not added. I have tried to refresh all the caches and also restarted the server, but nothing have changed.
What I am doing wrong ?
Magento version is 2.1.5
Thanks, Nick.