批量上传商品
接口路径
POST /api/v1/products/batch-index
请求方法
POST
频率限制
60RPM
请求体
请求体为一个包含多个对象的 JSON 数组,单次最多传500个商品。
| 参数名 | 参数类型 | 备注 |
|---|---|---|
type | Integer | 类型,必填。1=新增/更新商品全部信息,2=仅更新商品的库存/价格/销量/上架状态(标准版仅支持最外层) |
productId | String | 商品Id,必填 |
brandDisplay | String | 品牌名 |
productName | String | 必填,商品名称,当type=1时 |
mainImage | String | 必填,商品白底图,用于图像搜索,必须没有反爬措施,图片尺寸必须大于100x100小于4096x4096 |
isImageReady | Integer | mainImage是否为商品图 0=是,1=不是 |
imageUrls | List<String> | 商品图片 URL 列表 |
description | String | 商品简介 |
gender | String | 性别 |
series | String | 系列 |
category | String | 品类 |
style | String | 风格 |
color | String | 颜色 |
size | String | 尺码 |
material | String | 材质 |
design | String | 款式 |
price | BigDecimal | 必填,商品价格,用于价格筛选 |
discountPrice | BigDecimal | 折扣价 |
stock | Integer | 必填,商品库存,0=无库存,1=有库存,用于排序 |
status | Integer | 必填,上架状态,0=下架,1=上架 |
sales | Integer | 商品销量 |
isNew | Integer | 是否新品 |
releaseDate | Date | 上架时间 |
attr1 | String | 自定义冗余字段 |
attr2 | String | 自定义冗余字段 |
attr3 | String | 自定义冗余字段 |
attr4 | String | 自定义冗余字段 |
attr5 | String | 自定义冗余字段 |
attr6 | String | 自定义冗余字段 |
attr7 | String | 自定义冗余字段 |
attr8 | String | 自定义冗余字段 |
attr9 | String | 自定义冗余字段 |
attr10 | String | 自定义冗余字段 |
colors | Array | 颜色级别的商品数组对象 |
colors[].colorId | String | 颜色级别的商品id,如果没有可以不填 |
colors[].color | String | 颜色,可用于颜色筛选 |
colors[].rgba | String | 颜色RGBA |
colors[].mainImage | String | 商品白底图,用于图像搜索,必须没有反爬措施,图片尺寸必须大于100x100小于4096x4096 |
colors[].isImageReady | Integer | mainImage是否为商品图 0=是,1=不是 |
colors[].images | Array | 商品图片 URL 列表 |
colors[].price | BigDecimal | 颜色级别的商品价格 |
colors[].stock | Integer | 颜色级别的商品库存,0=无库存,1=有库存 |
colors[].attr1 | String | 自定义冗余字段,会在搜索结果中返回,可用于颜色筛选 |
colors[].attr2 | String | 自定义冗余字段,会在搜索结果中返回,可用于颜色筛选 |
colors[].attr3 | String | 自定义冗余字段,会在搜索结果中返回,可用于颜色筛选 |
colors[].sizes | Array | 尺码级别商品数组对象 |
colors[].sizes[].sizeId | String | 尺码级别的商品id,如果没有可以不填 |
colors[].sizes[].size | String | 尺码 |
colors[].sizes[].price | BigDecimal | 颜色级别的商品价格 |
colors[].sizes[].stock | Integer | 尺码级别的商品库存,0=无库存,1=有库存 |
colors[].sizes[].attr1 | String | 自定义冗余字段,会在搜索结果中返回,可用于尺码筛选 |
colors[].sizes[].attr2 | String | 自定义冗余字段,会在搜索结果中返回,可用于尺码筛选 |
colors[].sizes[].attr3 | String | 自定义冗余字段,会在搜索结果中返回,可用于尺码筛选 |
请求体示例
[
{
"productId": "123",
"productName": "印花卫衣,卫衣,Printed sweatshirt,Sweatshirt",
"mainImage": "https://example.com/image1.jpg",
"imageUrls": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"description": "棉混纺卫衣面料上衣,正面带印花图案,柔软拉绒内里。圆领有罗纹饰边,低落肩长袖设计,罗纹袖口和下摆。Top in sweatshirt fabric made from a cotton blend with a print motif on the front and a soft brushed inside. Round, rib-trimmed neckline, low dropped shoulders, long sleeves and ribbing at the cuffs and hem.",
"gender": "WOMEN",
"series": "TORINO",
"category": "上衣",
"style": "和风,仙女范",
"color": "蓝色",
"size": "S",
"material": "棉,聚酯纤维",
"design": "宽松版",
"price": 99.99,
"discountPrice": 88.88,
"stock": 1,
"status": 1,
"sales": 50,
"isNew": 1,
"releaseDate": "2023-10-01 00:00:00",
"colors": [
{
"colorId": "12345",
"color": "红色",
"rbga": "rgba(255,255,255,0)",
"mainImage": "https://example.com/image1.jpg",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"price": 99.99,
"discountPrice": 88.88,
"stock": 1,
"attr1": "",
"attr2": "",
"attr3": "",
"sizes": [
{
"sizeId": "12345678",
"size": "M",
"price": 99.99,
"discountPrice": 88.88,
"stock": 1,
"attr1": "",
"attr2": "",
"attr3": ""
}
]
}
]
}
]
响应体
| 参数名 | 类型 | 描述 |
|---|---|---|
code | int | 响应码,非200表示失败 |
message | String | 错误信息 |
data | Object | 错误详情,通常为空或包含错误信息 |
成功响应示例
{"code": 200,"message": "批量上传成功","data": {}}
失败响应示例
{"code": 400,"message": "请求参数不合法","data": {"error": "Missing required field: productName"}}