Description
Steps to reproduce
- Install Magento from
develop
branch. - Try creating a product through rest api call POST /V1/products/
- The product gets created but some of the fields do not show the values that were provided.
- Try updating the product through PUT /V1/products/:sku api call.
- The product still does not show any values for those fields.
- Fields which are not getting updated are :
a) Description
b) Special Price From Date / To Date
c) Tax Class
d) Meta-Description / Meta-Title / Meta - Keywords
e) Custom Design / Custom Design From Date
f) Any custom attribute that I created manually from the UI.(and assigned to the attribute set that I am using to create the product)
Expected result
- All the fields in UI should show the values provided in the request json body, on both POST and PUT calls.
Actual result
- Fields in UI do not show the values which were given during creation/updation of the product.
- A peculiar observation : If I make a GET call on the product, the json response body contains the correct values. But the values do not show up on the UI.
Sample JSON requests and UI screenshots
- ## Scenario 1 : Creation of product
a) POST /V1/products/
Sample request : `{
"product": {
"sku": "Item-10012",
"name": "Item-10012",
"attribute_set_id": 4,
"price": 14,
"status": 1,
"visibility": 4,
"type_id": "simple",
"weight": 1,
"extension_attributes": {
"stock_item": {
"stock_id": 1,
"is_in_stock": true,
"is_qty_decimal": true,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 10000,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": false,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
}
},
"product_links": [
{
"sku": "Item-10012",
"link_type": "related",
"linked_product_sku": "Helmet-Hulk-Red",
"linked_product_type": "simple",
"position": 0,
"extension_attributes": []
}
],
"options": [
],
"media_gallery_entries": [],
"tier_prices": [
{
"customer_group_id": 0,
"qty": 10,
"value": 12
},
{
"customer_group_id": 2,
"qty": 100,
"value": 8
}
],
"custom_attributes": [
{
"attribute_code": "special_price",
"value": "3.0000"
},
{
"attribute_code": "special_from_date",
"value": "2016-04-18 00:00:00"
},
{
"attribute_code": "special_to_date",
"value": "2016-05-12 00:00:00"
},
{
"attribute_code": "meta_title",
"value": "Item-10012"
},
{
"attribute_code": "meta_keyword",
"value": "Item-10012"
},
{
"attribute_code": "description",
"value": "<p>Item-10012 description</p>"
},
{
"attribute_code": "news_from_date",
"value": "2016-04-18 00:00:00"
},
{
"attribute_code": "custom_design",
"value": "1"
},
{
"attribute_code": "custom_design_from",
"value": "2016-04-18 00:00:00"
},
{
"attribute_code": "custom_design_to",
"value": "2016-05-06 00:00:00"
},
{
"attribute_code": "category_ids",
"value": [
"4",
"5"
]
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "required_options",
"value": "1"
},
{
"attribute_code": "has_options",
"value": "1"
},
{
"attribute_code": "tax_class_id",
"value": "2"
}
]
}
}`
Response : 200 OK
b) GET /V1/products/item-10012
Response : { "id": 49, "sku": "Item-10012", "name": "Item-10012", "attribute_set_id": 4, "price": 14, "status": 1, "visibility": 4, "type_id": "simple", "created_at": "2016-05-16 14:21:20", "updated_at": "2016-05-16 14:21:20", "weight": 1, "extension_attributes": { "stock_item": { "item_id": 47, "product_id": 49, "stock_id": 1, "qty": null, "is_in_stock": false, "is_qty_decimal": true, "show_default_notification_message": false, "use_config_min_qty": true, "min_qty": 0, "use_config_min_sale_qty": 1, "min_sale_qty": 1, "use_config_max_sale_qty": true, "max_sale_qty": 10000, "use_config_backorders": true, "backorders": 0, "use_config_notify_stock_qty": true, "notify_stock_qty": 1, "use_config_qty_increments": true, "qty_increments": 0, "use_config_enable_qty_inc": false, "enable_qty_increments": false, "use_config_manage_stock": true, "manage_stock": true, "low_stock_date": "2016-05-16 14:21:20", "is_decimal_divided": false, "stock_status_changed_auto": 1 } }, "product_links": [ { "sku": "Item-10012", "link_type": "related", "linked_product_sku": "Helmet-Hulk-Red", "linked_product_type": "simple", "position": 0, "extension_attributes": [] } ], "options": [], "media_gallery_entries": [], "tier_prices": [ { "customer_group_id": 0, "qty": 10, "value": 12 }, { "customer_group_id": 2, "qty": 100, "value": 8 } ], "custom_attributes": [ { "attribute_code": "description", "value": "<p>Item-10012 description</p>" }, { "attribute_code": "special_price", "value": "3.0000" }, { "attribute_code": "special_from_date", "value": "2016-04-18 00:00:00" }, { "attribute_code": "special_to_date", "value": "2016-05-12 00:00:00" }, { "attribute_code": "meta_title", "value": "Item-10012" }, { "attribute_code": "meta_keyword", "value": "Item-10012" }, { "attribute_code": "news_from_date", "value": "2016-04-18 00:00:00" }, { "attribute_code": "custom_design", "value": "1" }, { "attribute_code": "custom_design_from", "value": "2016-04-18 00:00:00" }, { "attribute_code": "custom_design_to", "value": "2016-05-06 00:00:00" }, { "attribute_code": "category_ids", "value": [ "4", "5" ] }, { "attribute_code": "options_container", "value": "container2" }, { "attribute_code": "required_options", "value": "0" }, { "attribute_code": "has_options", "value": "0" }, { "attribute_code": "url_key", "value": "item-10012" }, { "attribute_code": "tax_class_id", "value": "2" } ] }
c) UI Screenshots :
Please note that "Something" is a custom attribute created by me using the UI.
- ## Scenario 2 : Updation of product
a) PUT /V1/products/item-10012
Sample request : { "product": { "id": 49, "sku": "Item-10012", "name": "Item-10012", "attribute_set_id": 4, "price": 14, "status": 1, "visibility": 4, "type_id": "simple", "weight": 1, "extension_attributes": { "stock_item": { "item_id": 47, "product_id": 49, "stock_id": 1, "qty": null, "is_in_stock": false, "is_qty_decimal": true, "show_default_notification_message": false, "use_config_min_qty": true, "min_qty": 0, "use_config_min_sale_qty": 1, "min_sale_qty": 1, "use_config_max_sale_qty": true, "max_sale_qty": 10000, "use_config_backorders": true, "backorders": 0, "use_config_notify_stock_qty": true, "notify_stock_qty": 1, "use_config_qty_increments": true, "qty_increments": 0, "use_config_enable_qty_inc": false, "enable_qty_increments": false, "use_config_manage_stock": true, "manage_stock": true, "low_stock_date": "2016-05-16 14:21:20", "is_decimal_divided": false, "stock_status_changed_auto": 1 } }, "product_links": [ { "sku": "Item-10012", "link_type": "related", "linked_product_sku": "Helmet-Hulk-Red", "linked_product_type": "simple", "position": 0, "extension_attributes": [] } ], "options": [], "media_gallery_entries": [], "tier_prices": [ { "customer_group_id": 0, "qty": 10, "value": 12 }, { "customer_group_id": 2, "qty": 100, "value": 8 } ], "custom_attributes": [ { "attribute_code": "description", "value": "<p>Item-10012 updated description</p>" }, { "attribute_code": "special_price", "value": "3.0000" }, { "attribute_code": "special_from_date", "value": "2016-05-18 00:00:00" }, { "attribute_code": "special_to_date", "value": "2016-06-12 00:00:00" }, { "attribute_code": "meta_title", "value": "Item-10012 updated" }, { "attribute_code": "meta_keyword", "value": "Item-10012 updated" }, { "attribute_code": "news_from_date", "value": "2016-04-18 00:00:00" }, { "attribute_code": "custom_design", "value": "1" }, { "attribute_code": "custom_design_from", "value": "2016-05-18 00:00:00" }, { "attribute_code": "custom_design_to", "value": "2016-06-06 00:00:00" }, { "attribute_code": "category_ids", "value": [ "4", "5" ] }, { "attribute_code": "options_container", "value": "container2" }, { "attribute_code": "required_options", "value": "0" }, { "attribute_code": "has_options", "value": "0" }, { "attribute_code": "url_key", "value": "item-10012-up" }, { "attribute_code": "tax_class_id", "value": "2" } ] } }
Response : 200 OK
b) GET /V1/products/item-10012
Response : { "id": 49, "sku": "item-10012", "name": "Item-10012", "attribute_set_id": 4, "price": 14, "status": 1, "visibility": 4, "type_id": "simple", "created_at": "2016-05-16 14:21:20", "updated_at": "2016-05-16 14:30:42", "weight": 1, "extension_attributes": { "stock_item": { "item_id": 47, "product_id": 49, "stock_id": 1, "qty": null, "is_in_stock": false, "is_qty_decimal": true, "show_default_notification_message": false, "use_config_min_qty": true, "min_qty": 0, "use_config_min_sale_qty": 1, "min_sale_qty": 1, "use_config_max_sale_qty": true, "max_sale_qty": 10000, "use_config_backorders": true, "backorders": 0, "use_config_notify_stock_qty": true, "notify_stock_qty": 1, "use_config_qty_increments": true, "qty_increments": 0, "use_config_enable_qty_inc": false, "enable_qty_increments": false, "use_config_manage_stock": true, "manage_stock": true, "low_stock_date": "2016-05-16 14:30:42", "is_decimal_divided": false, "stock_status_changed_auto": 1 } }, "product_links": [ { "sku": "item-10012", "link_type": "related", "linked_product_sku": "Helmet-Hulk-Red", "linked_product_type": "simple", "position": 0, "extension_attributes": [] } ], "options": [], "media_gallery_entries": [], "tier_prices": [ { "customer_group_id": 0, "qty": 10, "value": 12 }, { "customer_group_id": 2, "qty": 100, "value": 8 } ], "custom_attributes": [ { "attribute_code": "description", "value": "<p>Item-10012 updated description</p>" }, { "attribute_code": "special_price", "value": "3.0000" }, { "attribute_code": "special_from_date", "value": "2016-05-18 00:00:00" }, { "attribute_code": "special_to_date", "value": "2016-06-12 00:00:00" }, { "attribute_code": "meta_title", "value": "Item-10012 updated" }, { "attribute_code": "meta_keyword", "value": "Item-10012 updated" }, { "attribute_code": "news_from_date", "value": "2016-04-18 00:00:00" }, { "attribute_code": "custom_design", "value": "1" }, { "attribute_code": "custom_design_from", "value": "2016-05-18 00:00:00" }, { "attribute_code": "custom_design_to", "value": "2016-06-06 00:00:00" }, { "attribute_code": "category_ids", "value": [ "4", "5" ] }, { "attribute_code": "options_container", "value": "container2" }, { "attribute_code": "required_options", "value": "0" }, { "attribute_code": "has_options", "value": "0" }, { "attribute_code": "url_key", "value": "item-10012-up" }, { "attribute_code": "tax_class_id", "value": "2" } ] }
c) UI Screenshots :
Exactly same as above.