Magento 2 REST API:响应中未反映产品价格和自定义属性颜色
我正在研究Magento2[v2.4]产品集成用例Magento 2 REST API:响应中未反映产品价格和自定义属性颜色,magento,Magento,我正在研究Magento2[v2.4]产品集成用例 我正在使用[postman]创建一个产品,并观察到产品价格,颜色属性出现在请求JSON中,但从Magento收到的响应中缺少这些属性 POST http://localhost/magento2/rest/V1/products Request: { "product": { "id": "2007", "sku": "
我正在使用[postman]创建一个产品,并观察到产品价格,颜色属性出现在请求JSON中,但从Magento收到的响应中缺少这些属性
POST http://localhost/magento2/rest/V1/products
Request:
{
"product": {
"id": "2007",
"sku": "20210004",
"name": "Iphone 4",
"price": "400",
"status": 1,
"extension_attributes": {
"stock_item": {
"qty": 4,
"is_in_stock": "true"
}
},
"custom_attributes": [
{
"attribute_code": "color",
"value": 4
}
]
}
}
Response:
{
"id": 2007,
"sku": "20210004",
"name": "Iphone 4",
"attribute_set_id": 4,
"status": 1,
"visibility": 4,
"extension_attributes": {
"stock_item": {
"item_id": 18,
"product_id": 2007,
"stock_id": 1,
"qty": 4,
"is_in_stock": true,
"is_qty_decimal": false
}
},
"custom_attributes": [
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "url_key",
"value": "iphone-4"
}
]
}
如果您查看请求和响应负载,您将看到请求中有价格和颜色,但不知何故,Magento没有遵守这些,并且在响应中错过了
如果我想让这个工作,我必须再次发送相同的有效载荷。然后我可以看到价格和颜色的反应。你能告诉我这里有什么问题吗