创建尺码模板
一、创建尺码模板
请求URL:
POST https://kf.fw199.com/gateway/dd/product/createcomponenttemplatev2
公共参数
| 参数名称 | 参数类型 | 是否必须 | 示例值 | 参数描述 |
|---|---|---|---|---|
| appid | String | 是 | 合作伙伴AppId | |
| timestamp | String | 是 | 1657525936 | 当前Unix时间戳,秒 |
| seller_nick | String | 是 | 38173182 | 抖店的账号,对应蜂巢授权返回doudianseller字段 |
| sign | String | 是 |
业务参数
| 参数名称 | 参数类型 | 是否必须 | 示例值 | 参数描述 |
|---|---|---|---|---|
| template_type | String | 是 | size_info | 模板类型:尺码模板 |
| template_sub_type | String | 是 | clothing | 模板子类型: clothing(服装)、undies(内衣)、shoes(鞋靴类)、children_clothing(童装) |
| template_name | String | 是 | 模板名称1 | 模板名称 |
| component_front_data | String | 是 | {“title”:”测试模板3”,”desc”:”测试”,”tempName”:”测试模板3副本1副本1”,”configTable”:[{“size”:”XS”,”specMap”:{“身高(cm)”:”1”,”体重(斤)”:”2”,”胸围(cm)”:”3”}},{“size”:”M”,”specMap”:{“身高(cm)”:”10”,”体重(斤)”:”10”,”胸围(cm)”:”10”}}],”selectedSpecs”:[“身高(cm)”,”体重(斤)”,”胸围(cm)”],”specOptions”:[“身高(cm)”,”体重(斤)”,”胸围(cm)”],”selectedSize”:[“XS”,”M”]} | 商品组件数据 json,表格行列顺序以selectedSize和selectedSpecs的顺序为准 |
| shareable | Bool | 否 | true | 是否设置为公有模板(多个商品可共用)。true-是,false-不是;不传默认fasle |
| category_id | Int64 | 否 | 214691 | 类目id,用来确定模板类型 |
二、请求示例代码
Java
请求示例代码
@Test public void DDProductCreateComponentTemplateV2() throws Exception { Map<String, Object> data = new HashMap<String, Object>(); data.put("appid", Config.AppId); Long timestamp = System.currentTimeMillis() / 1000; data.put("timestamp", timestamp.toString()); data.put("seller_nick", Config.DDSellerNick); data.put("template_type","size_info" ); data.put("template_sub_type","clothing" ); data.put("template_name","模板名称1" ); data.put("component_front_data","{\"title\":\"测试模板3\",\"desc\":\"测试\",\"tempName\":\"测试模板3副本1副本1\",\"configTable\":[{\"size\":\"XS\",\"specMap\":{\"身高(cm)\":\"1\",\"体重(斤)\":\"2\",\"胸围(cm)\":\"3\"}},{\"size\":\"M\",\"specMap\":{\"身高(cm)\":\"10\",\"体重(斤)\":\"10\",\"胸围(cm)\":\"10\"}}],\"selectedSpecs\":[\"身高(cm)\",\"体重(斤)\",\"胸围(cm)\"],\"specOptions\":[\"身高(cm)\",\"体重(斤)\",\"胸围(cm)\"],\"selectedSize\":[\"XS\",\"M\"]}" ); data.put("shareable","true" ); data.put("category_id","214691" ); data.put("sign", Sign(data,Config.AppSecret)); // 调用服务API String resp = doHttpRequest(Config.DDProductCreateComponentTemplateV2, data); System.out.println(resp); }三、返回结果
{"code":0,"message":"ok","data":{"template_id":7371368164526997798}}说明: code为0表示成功,非0为失败,message会包含失败原因。返回字段说明见文档 https://op.jinritemai.com/docs/api-docs/14/1992