文档地址 https://developers.weixin.qq.com/doc/channels/API/product/add.html
接口:
在java中用将字符串用 JSON.parse(productJson)转换后调用家口报错:data format error rid: 648d3f6f-765d5593-14b9beee 打印出来的json串入下所示: 尝试用postMan直接调用商品添加接口,传打印出来的json串报错,格式错误 将json串通过json格式化工具转换之后,放入postMan,可正常调用接口。 问,在java中该将json串的文本如何转换才能正常调用接口??? 尝试过直接将商品类传入新增商品接口,报错:10020096,商品参数属性键attrs[].attr_key不能重复
入参:{"deliver_method":1,"cats":[{"cat_id":"381003"},{"cat_id":"378005"},{"cat_id":"544002"}],"skus":[{"stock_num":99999,"sale_price":11100.00,"sku_attrs":[{"attr_key":"选择课程","attr_value":"线上课程"}]}],"sub_title":"11111111","desc_info":{"imgs":["https://mmecimage.cn/p/wx8130f9ea242ca3e4/HMt9a04UeNFZx_iuKy5vJGvWgOqiHXhtar319N5yNw"]},"limited_info":{"limited_buy_num":1,"period_type":4},"out_product_id":"12","extra_service":{"seven_day_return":0},"title":"11111111","attrs":[{"attr_key":"适用人群","attr_value":"成人"},{"attr_key":"发货形式","attr_value":"自动发货"},{"attr_key":"学习平台","attr_value":"小程序/公众号"},{"attr_key":"开课形式","attr_value":"提前预约"},{"attr_key":"课程有效期","attr_value":"永久有效"},{"attr_key":"总课时","attr_value":"100"},{"attr_key":"学习资料","attr_value":"无"},{"attr_key":"主要教学形式","attr_value":"线上视频课"}],"head_imgs":["https://mmecimage.cn/p/wx8130f9ea242ca3e4/HDpz8qETXHjGw7Ax2tkR3RKVxkkzGjIfGmP-aKOE5g","https://mmecimage.cn/p/wx8130f9ea242ca3e4/HCKzrGcVNU9SY__slNxE9D1ZEgT9Ag7yY8La9Dyv_Q","https://mmecimage.cn/p/wx8130f9ea242ca3e4/HJWO58lksuqWr-vEYdMwvug4kWLDy7KSbB68cspCfQ","https://mmecimage.cn/p/wx8130f9ea242ca3e4/HDnZspWgZF8uueO5L7-1vrnjw5mYlRVxK60iXUXY2w"]}
会报错:data format error rid: 648d3f6f-765d5593-14b9beee
在postman调用传参就能调用成功
{
"deliver_method":1,
"cats":[
{
"cat_id":"381003"
},
{
"cat_id":"378005"
},
{
"cat_id":"544002"
}
],
"skus":[
{
"stock_num":99999,
"sale_price":11100,
"sku_attrs":[
{
"attr_key":"选择课程",
"attr_value":"线上课程"
}
]
}
],
"sub_title":"11111111",
"desc_info":{
"imgs":[
"https://mmecimage.cn/p/wx8130f9ea242ca3e4/HMt9a04UeNFZx_iuKy5vJGvWgOqiHXhtar319N5yNw"
]
},
"limited_info":{
"limited_buy_num":1,
"period_type":4
},
"out_product_id":"12",
"extra_service":{
"seven_day_return":0
},
"title":"11111111",
"attrs":[
{
"attr_key":"适用人群",
"attr_value":"成人"
},
{
"attr_key":"发货形式",
"attr_value":"自动发货"
},
{
"attr_key":"学习平台",
"attr_value":"小程序/公众号"
},
{
"attr_key":"开课形式",
"attr_value":"提前预约"
},
{
"attr_key":"课程有效期",
"attr_value":"永久有效"
},
{
"attr_key":"总课时",
"attr_value":"100"
},
{
"attr_key":"学习资料",
"attr_value":"无"
},
{
"attr_key":"主要教学形式",
"attr_value":"线上视频课"
}
],
"head_imgs":[
"https://mmecimage.cn/p/wx8130f9ea242ca3e4/HDpz8qETXHjGw7Ax2tkR3RKVxkkzGjIfGmP-aKOE5g",
"https://mmecimage.cn/p/wx8130f9ea242ca3e4/HCKzrGcVNU9SY__slNxE9D1ZEgT9Ag7yY8La9Dyv_Q",
"https://mmecimage.cn/p/wx8130f9ea242ca3e4/HJWO58lksuqWr-vEYdMwvug4kWLDy7KSbB68cspCfQ",
"https://mmecimage.cn/p/wx8130f9ea242ca3e4/HDnZspWgZF8uueO5L7-1vrnjw5mYlRVxK60iXUXY2w"
]
}
贴代码看看