一次创建 1 至 500 个商品,每个商品可以包含多个 SKU。
5.1 请求
POST /openapi/products/actions/batch-create
{
"products": [
{
"name": "无水乙醇",
"productCode": "P-100001",
"brandId": "brand-1001",
"categoryId": "category-2001",
"deliveryCycle": "3天",
"mainImageUrl": "https://supplier.example.com/images/P-100001.jpg",
"casNumber": "64-17-5",
"description": "分析纯无水乙醇",
"officialWebsite": "https://supplier.example.com/products/P-100001",
"skus": [
{
"specification": "500ml/瓶",
"marketPrice": 40.00,
"discountPrice": 32.50
},
{
"specification": "2.5L/瓶",
"marketPrice": 150.00,
"discountPrice": 120.00
}
]
},
{
"name": "甲醇",
"productCode": "P-100002",
"brandId": "brand-1001",
"categoryId": "category-2001",
"deliveryCycle": "现货",
"mainImageUrl": "https://supplier.example.com/images/P-100002.jpg",
"skus": [
{
"specification": "500ml/瓶",
"marketPrice": 35.00,
"discountPrice": 29.90
}
]
}
]
}
5.2 成功响应
HTTP 状态码:200 OK
{
"code": "SUCCESS",
"message": "批量新增处理完成",
"data": {
"totalCount": 2,
"successCount": 1,
"failureCount": 1,
"successes": [
{
"index": 0,
"productCode": "P-100001",
"spuId": "spu-100001"
}
],
"failures": [
{
"index": 1,
"productCode": "P-100002",
"code": "BRAND_NOT_FOUND",
"message": "品牌不存在或不是当前供应商的有效品牌",
"fields": ["brandId"],
"sourceData": {
"name": "甲醇",
"productCode": "P-100002",
"brandId": "brand-invalid",
"categoryId": "category-2001"
}
}
]
}
}
5.3 业务规则
products必填,数量为 1 至 500。- 每个商品至少包含一个 SKU。
- 同一个商品下的 SKU 规格不能重复。
- 商品货号在当前供应商下必须唯一。
- 品牌和类目必须处于有效状态,并且当前供应商有权使用。
- 新增成功后,商品默认进入上架状态。
- 同一条商品内任意字段或 SKU 校验失败时,该条商品整体失败。
作者:吴群杰 创建时间:2026-10-10 16:15
最后编辑:吴群杰 更新时间:2026-10-10 17:37
最后编辑:吴群杰 更新时间:2026-10-10 17:37