获取匹配产品规则

发布商品前,需要先查找到产品ID,这个接口返回查找产品规则入参规则

1.请求参数:

请求URL:

POST https://kf.fw199.com/gateway/taobao/tmall/product/match/schema/get

参数名 类型 必须 示例值 说明
appid String true uwkahf@jfs92 合作伙伴AppId
timestamp String true 1633618722 当前时间戳
tb_seller_nick String true kingdo 淘宝卖家店铺登录账号,非店铺名称
sign String true 999de41d862efaa6f1084ead3b3ba480 如何计算生成见示例代码
category_id Number true 328818231125 商品发布的目标类目,必须是叶子类目

2. 请求示例代码(Java)

      @Test
    public void TmallProductMatchSchemaGetRequest() throws Exception {
        String tb_seller_nick = Config.TBSellerNick;
        //业务参数
        Map<String, String> data = new HashMap<String, String>();
        data.put("appid", Config.AppId);
        data.put("tb_seller_nick", tb_seller_nick);
        Long timestamp = System.currentTimeMillis() / 1000;
        data.put("timestamp", timestamp.toString());
        data.put("category_id", "50010731");
        data.put("sign", Utils.Sign(data, Config.AppSecret));
        // 调用服务API
        String rsp = doHttpRequest(Config.TmallProductMatchSchemaGetRequestUrl, data);
        // 需要进行编码转换,比如 "\u003c" 转成  "<"   ,  "\u003e" 转成 ">" 等
        String unescapeRsp = StringEscapeUtils.unescapeJavaScript(rsp);
        System.out.println(unescapeRsp);
    }

3. 返回结果

返回结果如下

{
    "code":0,
    "message":"ok",
    "data":{
        "match_result":"\u003citemRule\u003e\u003cfield id=\"prop_20000\" name=\"品牌\" type=\"singleCheck\"\u003e\u003crules\u003e\u003crule name=\"requiredRule\" value=\"true\"/\u003e\u003c/rules\u003e\u003c/field\u003e\u003c/itemRule\u003e",
        "request_id":"ii7ury6he84s"
    },
    "trace_id":""
}

说明: code为0表示成功,非0为失败,message会包含失败原因, match_result字段为返回匹配product的规则文档。

文档更新时间: 2023-04-14 22:19   作者:admin