4

Trying to Change only the price of the products with PUT method.

HERE http://devdocs.magento.com/guides/m1x/api/rest/Resources/Products/products.html#RESTAPI-Resource-Products-HTTPMethod-PUT-products--id

is stated that this is possible! But When i make a call with only the price in the product array i get a response like

 Array ( [message] => Invalid product data: %1 [parameters] => Array ( [0] => Invalid attribute set entity type ) ) 

So i add attribute set adn then i get the response

Array ( [message] => The value of attribute "name" must be set ) 

On the magento link here http://devdocs.magento.com/guides/m1x/api/rest/Resources/Products/products.html#RESTAPI-Resource-Products-HTTPMethod-PUT-products--id

Says that this should be possible with no other params

Enter only those parameters which you want to update.

Any ideas why is this happening?

the call i am using PUT /rest/V1/products/:sku

1 Answer 1

6

You can use the following rest PUT call:

/rest/V1/products/{SKU} 

Passing the following json:

{ "product": { "price": 9.63, "extension_attributes": { "stock_item": { "qty": 63 } } } } 

So you can update price and stock quantity with one single call. You can remove the extension_attributes value, if you only want to update the price.

EDIT

You will need a quotation mark for your price, like this below. I don't quite understand why because the price should be a double variable in the database.

{ "product":{ "price":"9.63", "extension_attributes":{ "stock_item":{ "qty":63 } } } } 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.