product匹配接口

根据tmall.product.match.schema.get获取到的规则,填充相应地的字段值以及类目,匹配符合条件的产品,返回匹配product结果,注意,有可能返回多个产品ID,以逗号分隔(尤其是图书类目);

1.请求参数:

请求URL:

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

参数名 类型 必须 示例值 说明
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 商品发布的目标类目,必须是叶子类目
propvalues String true <itemRule> <field id="prop_13021751" name="货号" type="input"><value>123</value> </field> <field id="prop_20000" name="品牌" type="singleCheck"><value>30111</value> </field> </itemRule> 根据tmall.product.match.schema.get获取到的模板,ISV将需要的字段填充好相应的值结果XML。

2. 请求示例代码(Java)

      @Test
    public void TmallProductSchemaMatchRequest() 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");
         String pv =  "<itemRule> \t\n" +
                "    <field id=\"prop_20000\" name=\"品牌\" type=\"singleCheck\">\n" +
                "        <value>13525264</value> \t\n" +
                "    </field> \n" +
                "<field id=\"prop_6362646\" name=\"型号\" type=\"singleCheck\">\n" +
                "        <value>693238758</value> \n" +
                "    </field>\n" +
                "</itemRule>";
        data.put("propvalues", pv);
        data.put("sign", Utils.Sign(data, Config.AppSecret));
        // 调用服务API
        String rsp = doHttpRequest(Config.TmallProductSchemaMatchRequestUrl, data);      
        System.out.println(rsp);
    }

上述代码中propvalues的示例如下:

<itemRule>     
    <field id="prop_20000" name="品牌" type="singleCheck">
        <value>13525264</value>     
    </field> 
<field id="prop_6362646" name="型号" type="singleCheck">
        <value>693238758</value> 
    </field>
</itemRule>

3. 返回结果

返回结果如下

{
    "code":0,
    "message":"ok",
    "data":{
        "match_result":"337259102",
        "request_id":"45js64fxk2x9"
    },
    "trace_id":""
}

说明: code为0表示成功,非0为失败,message会包含失败原因, match_result字段为返回匹配产品ID,部分类目可能返回多个产品ID,以逗号分隔。

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