根据商家ID和分类ID获取销售属性模板
通过商家ID和分类ID 获取销售属性模板 内部会通过商家白名单接口,判断是返回商家销售属性值模板还是返回结构化销售属性值模板。 templateData具体字段样例参见:https://joyspace.jd.com/pages/BIqTNsLGXWsg70lhdgBC
一、请求参数
请求URL:
POST https://kf.fw199.com/gateway/jd/category/read/findsaleattrtemplates
公共参数
| 参数名称 | 参数类型 | 是否必须 | 示例值 | 参数描述 |
|---|---|---|---|---|
| appid | String | 是 | 合作伙伴AppId | |
| timestamp | String | 是 | 1657525936 | 当前Unix时间戳,秒 |
| seller_nick | String | 是 | 38173182 | 京东的账号,对应蜂巢授权返回jdseller字段 |
| sign | String | 是 |
业务参数
| 名称 | 类型 | 必须 | 示例值 | 描述 |
|---|---|---|---|---|
| cid | Number | 是 | 9404 | 分类ID |
二、请求示例代码
Java
请求示例代码
@Test public void JDFindSaleAttrTemplates() throws Exception { String sellerNick = Config.JDSellerNick ; //业务参数 Map<String, String> data = new HashMap<String, String>(); data.put("appid", Config.AppId); data.put("seller_nick", sellerNick); Long timestamp = System.currentTimeMillis() / 1000; data.put("timestamp", timestamp.toString()); data.put("cid","12034"); data.put("sign", Utils.Sign(data, Config.AppSecret)); doHttpRequest(Config.JDFindSaleAttrTemplates, data); }三、返回结果
{ "code": 0, "message": "ok", "data": { "templateData": "[{\"attrId\":1000021481,\"type\":\"1\",\"valueRules\":\"{\\\"originCategoryId\\\":12034,\\\"description\\\":\\\"sale attr value templates\\\",\\\"type\\\":\\\"array\\\",\\\"title\\\":\\\"颜色\\\",\\\"items\\\":[{\\\"features\\\":{\\\"isLocked\\\":\\\"0\\\",\\\"text\\\":\\\"颜色\\\"},\\\"type\\\":\\\"object\\\",\\\"properties\\\":{\\\"id\\\":{\\\"type\\\":\\\"model\\\",\\\"enum\\\":[7000]},\\\"value\\\":{\\\"type\\\":\\\"model\\\",\\\"enum\\\":[{\\\"preprocessingSaleAttrValTemplateDTO\\\":{\\\"bu\\\":\\\"301\\\",\\\"features\\\":{\\\"isCrossLevel\\\":\\\"1\\\"},\\\"id\\\":300,\\\"templateName\\\":\\\"雪娇新-男女装-颜色\\\",\\\"yn\\\":1},\\\"preprocessingSaleAttrValTemplateValueList\\\":[{\\\"bu\\\":\\\"301\\\",\\\"children\\\":[{\\\"bu\\\":\\\"301\\\",\\\"fId\\\":1113736,\\\"id\\\":1113737,\\\"name\\\":\\\"花色\\\",\\\"orderSort\\\":1,\\\"templateId\\\":300,\\\"tenant\\\":\\\"1024\\\",\\\"yn\\\":1}],\\\"fId\\\":0,\\\"id\\\":1113736,\\\"name\\\":\\\"花色系\\\",\\\"orderSort\\\":10,\\\"templateId\\\":300,\\\"tenant\\\":\\\"1024\\\",\\\"yn\\\":1},{\\\"bu\\\":\\\"301\\\",\\\"children\\\":[{\\\"bu\\\":\\\"301\\\",\\\"fId\\\":1113766,\\\"features\\\":{\\\"class\\\":\\\"#00000000\\\"},\\\"id\\\":1113767,\\\"name\\\":\\\"透明\\\",\\\"orderSort\\\":1,\\\"templateId\\\":300,\\\"tenant\\\":\\\"1024\\\",\\\"yn\\\":1}],\\\"fId\\\":0,\\\"features\\\":{\\\"class\\\":\\\"#00000000\\\"},\\\"id\\\":1113766,\\\"name\\\":\\\"透明系\\\",\\\"orderSort\\\":11,\\\"templateId\\\":300,\\\"tenant\\\":\\\"1024\\\",\\\"yn\\\":1}]}]}}}]}\"},{\"attrId\":1000021440,\"type\":\"1\",\"valueRules\":\"{\\\"originCategoryId\\\":12034,\\\"description\\\":\\\"sale attr value templates\\\",\\\"type\\\":\\\"array\\\",\\\"title\\\":\\\"类型\\\",\\\"items\\\":[{\\\"features\\\":{\\\"isLocked\\\":\\\"1\\\",\\\"text\\\":\\\"打开方式\\\"},\\\"type\\\":\\\"object\\\",\\\"properties\\\":{\\\"id\\\":{\\\"type\\\":\\\"model\\\",\\\"enum\\\":[7001]},\\\"value\\\":{\\\"type\\\":\\\"model\\\",\\\"enum\\\":[{\\\"preprocessingSaleAttrValTemplateDTO\\\":{\\\"bu\\\":\\\"301\\\",\\\"features\\\":{\\\"isCrossLevel\\\":\\\"1\\\"},\\\"id\\\":450,\\\"templateName\\\":\\\"道具伞-打开方式\\\",\\\"yn\\\":1},\\\"preprocessingSaleAttrValTemplateValueList\\\":[{\\\"bu\\\":\\\"301\\\",\\\"fId\\\":0,\\\"features\\\":{\\\"class\\\":\\\"#1677ff00\\\"},\\\"id\\\":1117565,\\\"name\\\":\\\"手动\\\",\\\"orderSort\\\":1,\\\"templateId\\\":450,\\\"tenant\\\":\\\"1024\\\",\\\"yn\\\":1},{\\\"bu\\\":\\\"301\\\",\\\"fId\\\":0,\\\"features\\\":{\\\"class\\\":\\\"#1677ff00\\\"},\\\"id\\\":1117564,\\\"name\\\":\\\"半自动\\\",\\\"orderSort\\\":1,\\\"templateId\\\":450,\\\"tenant\\\":\\\"1024\\\",\\\"yn\\\":1},{\\\"bu\\\":\\\"301\\\",\\\"fId\\\":0,\\\"features\\\":{\\\"class\\\":\\\"#1677ff00\\\"},\\\"id\\\":1117563,\\\"name\\\":\\\"全自动\\\",\\\"orderSort\\\":1,\\\"templateId\\\":450,\\\"tenant\\\":\\\"1024\\\",\\\"yn\\\":1}]}]}}},{\\\"features\\\":{\\\"isLocked\\\":\\\"0\\\",\\\"text\\\":\\\"备注\\\"},\\\"type\\\":\\\"object\\\",\\\"properties\\\":{\\\"id\\\":{\\\"type\\\":\\\"number\\\",\\\"enum\\\":[7002]},\\\"value\\\":{\\\"type\\\":\\\"string\\\"}}}]}\"}]", "templateType": "2" }}说明: code为0表示成功,非0为失败,message会包含失败原因。
四、返回字段说明
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| categoryAttrTemplates | com.jd.pop.ware.ic.api.domain.CategoryAttrTemplates | 返回对象 | - |
| templateType | String | 2 | 模板类型,1:商家维度销售属性值模板,2:销售属性值结构化模板 |
| templateData | String (json) | 模板数据示例 | 模板数据,解析方式参考:登录JoySpace |