版本:202201
创建子款式
POST/openapi/2022-01/products/:product_id/variants
根据提供的信息创建一个新的子款式。
请求
Path参数
product_id string必填
子款式所属的商品 ID。
- application/json
- 请求体
- 示例
请求体
- Array [
- ]
variant object
option1string
The first style value of the variant
option2string
The second style value of the variant
option3string
The second style value of the variant
image_idstring
compare_at_pricestring
Variant original price, used for comparison with the actual price, can be converted to float64, supports only two decimal places
pricestring
Variant actual price, can be converted to float64, supports only two decimal places, set to "0.00" if price needs to be empty
positionint32必填
skustring
barcodestring
notestring
inventory_quantityint32
weightstring
weight_unitstring
Weight unit, supports kg, g, lb, oz
cost_pricestring
wholesale_price object[]
pricestring
min_quantityint32
Mini Order Quantity
{
"variant": {
"option1": "string",
"option2": "string",
"option3": "string",
"image_id": "string",
"compare_at_price": "string",
"price": "string",
"position": 0,
"sku": "string",
"barcode": "string",
"note": "string",
"inventory_quantity": 0,
"weight": "string",
"weight_unit": "string",
"cost_price": "string",
"wholesale_price": [
{
"price": "string",
"min_quantity": 0
}
]
}
}
响应
- 200
- 404
- 422
200
- application/json
- 数据结构
- 示例
- Result
数据结构
- Array [
- ]
variant object
idstring
示例:
1b735278-62c7-41ad-9976-b1b63a90590dproduct_idstring
示例:
636a07da-39eb-4829-bde9-b65fae1c28b0image_idstring
示例:
91d032e7-bbc8-47e4-8668-9ba6fe714de6created_atstring
示例:
2024-04-15T02:00:57Zupdated_atstring
示例:
2024-04-15T02:00:57Ztitlestring
示例:
S-redoption1string
示例:
Soption2string
示例:
redoption3string
示例:
image object
srcstring
示例:
//cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.pngwidthinteger
默认值:
0示例:
1588heightinteger
默认值:
0示例:
2246pathstring
示例:
efd33b921cacd5311a32dd03a9bc8740.pngaltstring
示例:
positioninteger
默认值:
0示例:
1compare_at_pricestring
示例:
100.00pricestring
示例:
100.00skustring
示例:
S-REDbarcodestring
示例:
123notestring
示例:
s-redinventory_quantityinteger
默认值:
0示例:
10weightstring
示例:
0.10weight_unitstring
示例:
kgcost_pricestring
示例:
11.00wholesale_price object[]
pricestring
示例:
100.00min_quantityinteger
默认值:
0示例:
1extend
{
"variant": {
"id": "1b735278-62c7-41ad-9976-b1b63a90590d",
"product_id": "636a07da-39eb-4829-bde9-b65fae1c28b0",
"image_id": "91d032e7-bbc8-47e4-8668-9ba6fe714de6",
"created_at": "2024-04-15T02:00:57Z",
"updated_at": "2024-04-15T02:00:57Z",
"title": "S-red",
"option1": "S",
"option2": "red",
"option3": "",
"image": {
"src": "//cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.png",
"width": 1588,
"height": 2246,
"path": "efd33b921cacd5311a32dd03a9bc8740.png",
"alt": ""
},
"position": 1,
"compare_at_price": "100.00",
"price": "100.00",
"sku": "S-RED",
"barcode": "123",
"note": "s-red",
"inventory_quantity": 10,
"weight": "0.10",
"weight_unit": "kg",
"cost_price": "11.00",
"wholesale_price": [
{
"price": "100.00",
"min_quantity": 1
}
],
"extend": {}
}
}
{
"variant": {
"id": "1b735278-62c7-41ad-9976-b1b63a90590d",
"product_id": "636a07da-39eb-4829-bde9-b65fae1c28b0",
"image_id": "91d032e7-bbc8-47e4-8668-9ba6fe714de6",
"created_at": "2024-04-15T02:00:57Z",
"updated_at": "2024-04-15T02:00:57Z",
"title": "S-red",
"option1": "S",
"option2": "red",
"option3": "",
"image": {
"src": "//cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.png",
"width": 1588,
"height": 2246,
"path": "efd33b921cacd5311a32dd03a9bc8740.png",
"alt": ""
},
"position": 1,
"compare_at_price": "100.00",
"price": "100.00",
"sku": "S-RED",
"barcode": "123",
"note": "s-red",
"inventory_quantity": 10,
"weight": "0.10",
"weight_unit": "kg",
"cost_price": "11.00",
"wholesale_price": [
{
"price": "100.00",
"min_quantity": 1
}
],
"extend": null
}
}
404
- application/json
- 数据结构
- 示例
- Result
数据结构
errorsstring[]
{
"errors": [
"Product not found"
]
}
{
"errors": [
"Product not found"
]
}
422
- application/json
- 数据结构
- 示例
- Result
数据结构
errorsstring[]
{
"errors": [
"Price must be entered."
]
}
{
"errors": [
"Price must be entered."
]
}