I spend lot of time to understand ... I had same problem. On development my java application, using official API, first i create product with one (main image), after I trying to add more images with Your error.
Solution is VERY SIMPLE. When You add more than one image, avoid to add ID in json call. (I have my own Java model which reproduce original API and NEVER use "int" => use "Integer" instead, for all keys at model)
BAD:
{
"entry": {
"id": 0,
"mediaType": "image",
"position": 0,
"disabled": false,
"types": ["image", "small_image", "thumbnail"],
"content":{
"base64_encoded_data" : "_9j_4AAQSkZJRgABAQEAYABgAAD__...<cutted_here>",
"type": "image/jpeg",
"name":"pic_name.jpg"
}
}
}
Right way:
{
"entry": {
"mediaType": "image",
"position": 0,
"disabled": false,
"types": ["image", "small_image", "thumbnail"],
"content":{
"base64_encoded_data" : "_9j_4AAQSkZJRgABAQEAYABgAAD__...<cutted_here>",
"type": "image/jpeg",
"name":"pic_name.jpg"
}
}
}
When You read official documentation is NO describe to right way. I've founded solution looking here:
line 509, see : if (isset($entry['id']))
at ./vendor/magento/module-catalog/Model/ProductRepository.php
PHP is looking if ID is set !!!
Alberto
I'm pretty sure I had the same problem. Try and change the route to: /all/V1/products/{sku}
"all" applies to All Store views. Price and weight are global attributes and therefore not changed because /V1/products/{sku} only updates a store view.
I have not found any documentation on this topic...
Best Answer
This is correct, the simple product is basically the product you want. However, price and quantity are stored in the configurable product.
So take the SKU of the simple product but qty and price of the configurable product and you should be fine.