跳到主要内容

批量上传商品

时序图

接口路径

POST /api/v1/products/batch-index

请求方法

POST

频率限制

60RPM

请求体

请求体为一个包含多个对象的 JSON 数组,单次最多传500个商品。

参数名参数类型备注
typeInteger类型,必填。1=新增/更新商品全部信息,2=仅更新商品的库存/价格/销量/上架状态(标准版仅支持最外层)
productIdString商品Id,必填
brandDisplayString品牌名
productNameString必填,商品名称,当type=1
mainImageString必填,商品白底图,用于图像搜索,必须没有反爬措施,图片尺寸必须大于100x100小于4096x4096
isImageReadyIntegermainImage是否为商品图 0=是,1=不是
imageUrlsList<String>商品图片 URL 列表
descriptionString商品简介
genderString性别
seriesString系列
categoryString品类
styleString风格
colorString颜色
sizeString尺码
materialString材质
designString款式
priceBigDecimal必填,商品价格,用于价格筛选
discountPriceBigDecimal折扣价
stockInteger必填,商品库存,0=无库存,1=有库存,用于排序
statusInteger必填,上架状态,0=下架,1=上架
salesInteger商品销量
isNewInteger是否新品
releaseDateDate上架时间
attr1String自定义冗余字段
attr2String自定义冗余字段
attr3String自定义冗余字段
attr4String自定义冗余字段
attr5String自定义冗余字段
attr6String自定义冗余字段
attr7String自定义冗余字段
attr8String自定义冗余字段
attr9String自定义冗余字段
attr10String自定义冗余字段
colorsArray颜色级别的商品数组对象
colors[].colorIdString颜色级别的商品id,如果没有可以不填
colors[].colorString颜色,可用于颜色筛选
colors[].rgbaString颜色RGBA
colors[].mainImageString商品白底图,用于图像搜索,必须没有反爬措施,图片尺寸必须大于100x100小于4096x4096
colors[].isImageReadyIntegermainImage是否为商品图 0=是,1=不是
colors[].imagesArray商品图片 URL 列表
colors[].priceBigDecimal颜色级别的商品价格
colors[].stockInteger颜色级别的商品库存,0=无库存,1=有库存
colors[].attr1String自定义冗余字段,会在搜索结果中返回,可用于颜色筛选
colors[].attr2String自定义冗余字段,会在搜索结果中返回,可用于颜色筛选
colors[].attr3String自定义冗余字段,会在搜索结果中返回,可用于颜色筛选
colors[].sizesArray尺码级别商品数组对象
colors[].sizes[].sizeIdString尺码级别的商品id,如果没有可以不填
colors[].sizes[].sizeString尺码
colors[].sizes[].priceBigDecimal颜色级别的商品价格
colors[].sizes[].stockInteger尺码级别的商品库存,0=无库存,1=有库存
colors[].sizes[].attr1String自定义冗余字段,会在搜索结果中返回,可用于尺码筛选
colors[].sizes[].attr2String自定义冗余字段,会在搜索结果中返回,可用于尺码筛选
colors[].sizes[].attr3String自定义冗余字段,会在搜索结果中返回,可用于尺码筛选

请求体示例

[
{
"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": ""
}
]
}
]
}
]

响应体

参数名类型描述
codeint响应码,非200表示失败
messageString错误信息
dataObject错误详情,通常为空或包含错误信息

成功响应示例

{"code": 200,"message": "批量上传成功","data": {}}

失败响应示例

{"code": 400,"message": "请求参数不合法","data": {"error": "Missing required field: productName"}}