我曾经C#调用magento Rest api来创建一个新产品(magento version 2.2.5)
这是身体数据:
{
"product": {
"id": 0,
"sku": "MS-Champ11",
"name": "Champ Tee11",
"attribute_set_id": 9,
"price": 110,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": null,
"updated_at": null,
"weight": 5,
"extension_attributes": null,
"product_links": null,
"options": null,
"media_gallery_entries": null,
"tier_prices": null,
"custom_attributes": [
{
"attribute_code": "description",
"value": "Test Description"
}
]
},
"save_options": false
}
Run Code Online (Sandbox Code Playgroud)
这是我的 C# 代码:
public string CreateProduct(Product product)
{
try
{
var request = CreateRequest("/rest/V1/products", Method.POST, Token);
var prod …Run Code Online (Sandbox Code Playgroud)