获取商品类目

请一定使用最小层级类目id,发布商品或更新商品。
接口使用注意点:
1、第一次请求cid=0获取所有一级类目
2、先判断enable=true,如果enable=false表示该类目已经失效,请勿使用。
3、循环获取最小层级类目id方式:再判断is_leaf=true或false。is_leaf=true表示是叶子节点,最小层级类目id。is_leaf=false表示不是子节点,请求参数cid=上一次响应参数id,直到获取最小层级类目id。

请求URL:

POST https://kf.fw199.com/gateway/dd/shop/getshopcategory

公共参数

参数名称 参数类型 是否必须 示例值 参数描述
appid String 合作伙伴AppId
timestamp String 1657525936 当前Unix时间戳,秒
seller_nick String 38173182 抖店的账号,对应蜂巢授权返回doudianseller字段
sign String

业务参数

参数名称 参数类型 是否必须 示例值 参数描述
cid Int64 0 父类目id,根据父id可以获取子类目。首次请求传值为0可以获取所有一级类目。循环调用接口获取最小层级类目id,根据响应参数判断is_leaf=truefalseis_leaf=true表示是叶子节点,获取最小层级类目id,is_leaf=false表示不是子节点,请求参数cid=上一次响应参数id,直到获取最小层级类目id。

2. 请求示例代码(Java)

请求示例代码

    @Test
    public void  DDGetShopCategory() 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("cid", 0);
        data.put("sign", Sign(data,Config.AppSecret));
        // 调用服务API
        String resp = doHttpRequest(Config.DDShopGetShopCategory, data);
        System.out.println(resp);
    }

3. 返回结果如下:

{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "enable": true,
      "id": 20005,
      "is_leaf": false,
      "level": 1,
      "name": "女装",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20009,
      "is_leaf": false,
      "level": 1,
      "name": "男装",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20062,
      "is_leaf": false,
      "level": 1,
      "name": "内衣裤袜",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20093,
      "is_leaf": false,
      "level": 1,
      "name": "服饰配件/皮带/帽子/围巾",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20006,
      "is_leaf": false,
      "level": 1,
      "name": "女鞋",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20010,
      "is_leaf": false,
      "level": 1,
      "name": "男鞋",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20011,
      "is_leaf": false,
      "level": 1,
      "name": "箱包",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20026,
      "is_leaf": false,
      "level": 1,
      "name": "户外/登山/野营/旅行用品",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20027,
      "is_leaf": false,
      "level": 1,
      "name": "运动/瑜伽/健身/球迷用品",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20046,
      "is_leaf": false,
      "level": 1,
      "name": "运动鞋",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20051,
      "is_leaf": false,
      "level": 1,
      "name": "电动车/配件/交通工具",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20052,
      "is_leaf": false,
      "level": 1,
      "name": "运动包/户外包/配件",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20053,
      "is_leaf": false,
      "level": 1,
      "name": "运动服/休闲服装",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20054,
      "is_leaf": false,
      "level": 1,
      "name": "自行车/骑行装备/零配件",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20003,
      "is_leaf": false,
      "level": 1,
      "name": "打火机/瑞士军刀/眼镜",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20047,
      "is_leaf": false,
      "level": 1,
      "name": "钟表类",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20080,
      "is_leaf": false,
      "level": 1,
      "name": "时尚饰品",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20110,
      "is_leaf": false,
      "level": 1,
      "name": "手工艺/非遗技艺",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 33691,
      "is_leaf": false,
      "level": 1,
      "name": "文玩/木作/书画/钱币",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20029,
      "is_leaf": false,
      "level": 1,
      "name": "彩妆/香水/美妆工具",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20038,
      "is_leaf": false,
      "level": 1,
      "name": "美容/个护仪器",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20085,
      "is_leaf": false,
      "level": 1,
      "name": "美容护肤",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20056,
      "is_leaf": false,
      "level": 1,
      "name": "个人护理",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20115,
      "is_leaf": false,
      "level": 1,
      "name": "洗护清洁剂/卫生巾/纸/香薰",
      "parent_id": 0
    },
    {
      "enable": true,
      "id": 20016,
      "is_leaf": false,
      "level": 1,
      "name": "农机/农具/农膜",
      "parent_id": 0
    }
  ]
}

说明: code为0表示成功,非0为失败,message会包含失败原因。返回字段说明见文档
https://op.jinritemai.com/docs/api-docs/13/1820

文档更新时间: 2024-12-11 19:21   作者:JSL