首页 > API调用场景 > 商品调用场景说明 > 商品发布

商品发布

jingdong.ware.write.add 商品发布   

1.文档说明

  商品发布

2.参数说明

ps: 返回时会将skus放入ware对象,并补充wareIdskuId

4.调用示例

添加两个商品 注意一定要设置销售属性

Ware ware = new Ware();
ware.setJdPrice(new BigDecimal(50));
// ware.setBrandId(0L);
List<Sku> skuList = new ArrayList<Sku>();
//sku构建
Sku sku = new Sku();
sku.setVenderId(venderId);
sku.setJdPrice(new BigDecimal(50));
sku.setStockNum(1L);
Set<Prop> saleAttrs = new HashSet<>();
//颜色
Prop prop = new Prop();
prop.setAttrId("1000000041");
String [] valueAlias = {"红色"};
prop.setAttrValueAlias(valueAlias);
prop.setIndex(1);
String[] attrValues = {"1001415136"};
prop.setAttrValues(attrValues);
//尺码
// Prop prop1 = new Prop();
// prop1.setAttrId("1000000046");
// String [] valueAlias1 = {"S"};
// prop1.setAttrValueAlias(valueAlias1);
// prop.setIndex(1);
// String[] attrValues1 = {"1001415126"};
// prop1.setAttrValues(attrValues1);
saleAttrs.add(prop);
// saleAttrs.add(prop1);
sku.setSaleAttrs(saleAttrs);
//sku构建
Sku sku2 = new Sku();
sku2.setVenderId(venderId);
sku2.setJdPrice(new BigDecimal(50));
sku2.setStockNum(1L);
Set<Prop> saleAttrs2 = new HashSet<>();
//颜色
Prop prop22 = new Prop();
prop22.setAttrId("1000000041");
String [] valueAlias22 = {"深红色"};
prop22.setAttrValueAlias(valueAlias22);
prop22.setIndex(2);
String[] attrValues22 = {"1001415137"};
prop22.setAttrValues(attrValues22);
//尺码
// Prop prop23 = new Prop();
// prop23.setAttrId("1000000046");
// String [] valueAlias23 = {"M"};
// prop23.setAttrValueAlias(valueAlias23);
// prop23.setIndex(2);
// String[] attrValues23 = {"1001415127"};
// prop23.setAttrValues(attrValues23);
saleAttrs2.add(prop22);
// saleAttrs2.add(prop23);
sku2.setSaleAttrs(saleAttrs2);
 
skuList.add(sku);
skuList.add(sku2);
ware.setSkus(skuList);
public JdClient client=new DefaultJdClient(SERVER_URL,accessToken,appKey,appSecret);
WareWriteAddRequest request =new WareWriteAddRequest();
request.setWare(ware);
request.setSkus(ware.getSkus());

WareWriteAddResponse response=client.execute(request);