Closed pardahlman closed 7 years ago
Hi @pardahlman ,
Actually, the behaviour for the product values is particular : https://api.akeneo.com/documentation/update.html#patch-product-values
Following the documentation, it's normal that it does not delete the other attribute.
FYI, if it would have been the same behaviour as for the other entities, it would have those drawbacks :
you can't update a product value for a specific locale/scope without getting all the products values of the other locales/scopes => you would have been forced to GET a product before doing a PATCH
you GET a product by filtering product values on locale/scope, and then patch the product values => the product values are filtered on locale/scope, and then, you would have delete the other product values that are not for this locale/scope
I hope it was clear enough :)
Hello @ahocquard - thanks for making this clear to me. I see that it makes sense in the scenarios you described. However, I also see scenarios where it would be desirable to remove product values from the product all together (similar to what the GUI lets you do with). Especially if the attribute is a bool type, where the existence of the value have significance downstream. Is there a way for me to remove values from a product through the API?
The closest I see is this example , that allows me to remove the value's data, but not the attribute value altogether.
For now, this is the way to go. We are well aware that's is not the ideal solution and it will be fix in a patch or in a next version (it implies to clean the product values in DB and it's not the ideal solution in a patch...).
On the boolean part, the main problem is not the API, it's the UI that does not handle boolean true/false/null but only true/false.
I think that the problem is on track and will be fix in the next version.
I've gotten the answers I was looking for, thanks! It's up to you if you want to close the issue or keep it open for reference for the fixes you suggest.
You're welcome, I close the issue.
Hello again 🙂 ,
Still running Akeneo PIM 1.7 CE
akeneo-pim-system-info_2017-04-23_17-21.txt
I have an existing product with two attributes. I use the update/create a product API endpoint to update the product. The updated product's
values
only contains one of the two attribute. The request is accepted and the API returns204 No Content
. When looking at the product, the value of the provided attribute is updated (✔️ expected), but the omitted attribute is still present (❌ not expected).If I'm reading the documentation for Update behavior right (more specific Rule 2: Non object update), the product's (array) property
values
should be replaced, as it is a non object. In fact I think that the second example close to identical to what I'm doing.I'm expecting the same behavior as when clicking the Remove this attribute in the GUI.