Update product by ID
PUT {{baseUrl}}/products/:id
IMPORTANT: You should send all option, category, attribute if you want to modify one of these information, because if you miss an item for example from the category array, it will be removed.This is the way how you can remove an option or category.
Service urls:
http://yourdomain.com/api/rest_admin/products/{product_id}
OR
http://yourdomain.com/index.php?route=rest/product_admin/products&id={product_id}
You can send option value's sku, if your system support this feature
product_option_value: [
{
price: 10,
price_prefix:+,
subtract:0,
points:0,
points_prefix:0,
weight:0,
weight_prefix:0,
option_value_id:46,
quantity:300,
option_sku:demo_option_sku
}
]
Possible update only specific fields /sku, model, quantity, status, price, manufacturerid, sortorder, taxclassid/
ONLY productid is mandatory
{
model: "testmodel,quantity
:2
}
OR
{
quantity:2
}
If you only want to update the quantity of the product options and some product data:
{
productid:30,quantity
:996,price
:198,productoptionquantityupdate
:1,productoption
: [productoptionvalue
{
:productoptionvalueid
[
{
:15,quantity
:122productoptionvalueid
},
{
:16,quantity
:211
}
]
}
]
}
If you only want to update the quantity and price of the product options and some product data:
{
productid:30,quantity
:996,price
:198,productoptionupdate
:1,productoption
: [productoptionvalue
{
:productoptionvalueid
[
{
:15,quantity
:122,price
:10productoptionvalue_id
},
{
:16,quantity
:211,price
:5"
}
]
}
]
}
Request Body
{"model"=>"<string>", "quantity"=>1, "price"=>"<double>", "tax_class_id"=>0, "manufacturer_id"=>0, "sku"=>"<string>", "product_seo_url"=>[{"keyword"=>"<string>", "language_id"=>"<integer>", "store_id"=>"<integer>"}, {"keyword"=>"<string>", "language_id"=>"<integer>", "store_id"=>"<integer>"}], "status"=>1, "points"=>"<integer>", "reward"=>"<integer>", "image"=>"<string>", "other_images"=>["<string>", "<string>"], "shipping"=>1, "stock_status_id"=>6, "upc"=>"<string>", "ean"=>"<string>", "jan"=>"<string>", "isbn"=>"<string>", "mpn"=>"<string>", "location"=>"<string>", "date_available"=>"<date>", "weight"=>"<double>", "weight_class_id"=>"<integer>", "length"=>"<double>", "width"=>"<double>", "height"=>"<double>", "length_class_id"=>"<integer>", "subtract"=>1, "minimum"=>1, "sort_order"=>1, "product_store"=>[0, 0], "product_related"=>["<integer>", "<integer>"], "product_filter"=>["<integer>", "<integer>"], "product_description"=>[{"name"=>"<string>", "meta_title"=>"<string>", "language_id"=>1, "description"=>"<string>", "meta_description"=>"<string>", "meta_keyword"=>"<string>", "tag"=>"<string>"}, {"name"=>"<string>", "meta_title"=>"<string>", "language_id"=>1, "description"=>"<string>", "meta_description"=>"<string>", "meta_keyword"=>"<string>", "tag"=>"<string>"}], "product_category"=>["<integer>", "<integer>"], "product_special"=>[{"customer_group_id"=>"<integer>", "price"=>"<double>", "priority"=>"<integer>", "date_start"=>"<string>", "date_end"=>"<string>"}, {"customer_group_id"=>"<integer>", "price"=>"<double>", "priority"=>"<integer>", "date_start"=>"<string>", "date_end"=>"<string>"}], "product_discount"=>[{"name"=>"<string>", "customer_group_id"=>"<integer>", "price"=>"<double>", "priority"=>"<integer>", "quantity"=>"<integer>", "date_start"=>"<string>", "date_end"=>"<string>"}, {"name"=>"<string>", "customer_group_id"=>"<integer>", "price"=>"<double>", "priority"=>"<integer>", "quantity"=>"<integer>", "date_start"=>"<string>", "date_end"=>"<string>"}], "product_attribute"=>[{"attribute_id"=>"<integer>", "product_attribute_description"=>[{"language_id"=>"<integer>", "text"=>"<string>"}, {"language_id"=>"<integer>", "text"=>"<string>"}]}, {"attribute_id"=>"<integer>", "product_attribute_description"=>[{"language_id"=>"<integer>", "text"=>"<string>"}, {"language_id"=>"<integer>", "text"=>"<string>"}]}], "product_option"=>[{"type"=>"<string>", "option_id"=>"<integer>", "product_option_value"=>[{"price"=>"<double>", "price_prefix"=>"<string>", "quantity"=>"<integer>", "subtract"=>1, "option_value_id"=>"<integer>", "points"=>"<integer>", "points_prefix"=>"<string>", "weight"=>"<integer>", "weight_prefix"=>"<string>"}, {"price"=>"<double>", "price_prefix"=>"<string>", "quantity"=>"<integer>", "subtract"=>1, "option_value_id"=>"<integer>", "points"=>"<integer>", "points_prefix"=>"<string>", "weight"=>"<integer>", "weight_prefix"=>"<string>"}], "required"=>"<integer>"}, {"type"=>"<string>", "option_id"=>"<integer>", "product_option_value"=>[{"price"=>"<double>", "price_prefix"=>"<string>", "quantity"=>"<integer>", "subtract"=>1, "option_value_id"=>"<integer>", "points"=>"<integer>", "points_prefix"=>"<string>", "weight"=>"<integer>", "weight_prefix"=>"<string>"}, {"price"=>"<double>", "price_prefix"=>"<string>", "quantity"=>"<integer>", "subtract"=>1, "option_value_id"=>"<integer>", "points"=>"<integer>", "points_prefix"=>"<string>", "weight"=>"<integer>", "weight_prefix"=>"<string>"}], "required"=>"<integer>"}]}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string | ||
Accept | string |
RESPONSES
status: OK
{"success":"\u003cinteger\u003e","error":["\u003cstring\u003e","\u003cstring\u003e"],"data":"\u003cobject\u003e"}