电商平台商品类目列表

获取电商平台的商品类目列表

一、接口名称

  • 接口名称:电商平台商品类目列表
  • 接口地址:https://kf.fw199.com/gateway/eop/cats/list
  • 请求方式:POST
  • Content-Type:application/x-www-form-urlencoded

按电商平台标识 op 与父类目 parent_cid 查询直接子类目列表的记录。可选传入 name 对类目名称做模糊匹配。

典型用法:

  1. 首次传 parent_cid=0 获取一级类目
  2. 用户选中某类目后,以其 cid 作为下一次请求的 parent_cid,逐级下钻
  3. 需要搜索时,在指定父类目下附加 name 关键词

二、请求参数

公共参数

参数名 类型 是否必需 说明
appid string 必需 开发者 appid
timestamp string 必需 时间戳(
sign string 必需 参数签名,算法见 蜂巢开放平台开发指南

业务参数

参数名 类型 是否必需 说明
op string 必需 电商平台标识,见下表
parent_cid string 必需 父类目 ID。查询一级类目时传 0
name string 类目名称关键词,对 name 字段做模糊匹配

op 平台标识(常用)

op 平台
1 淘宝
2 拼多多
3 抖店
5 京东
8 快手

三、请求示例代码(Java)

示例一:查询抖店一级类目

@Test
public void eopCatsListRoot() throws Exception {

    String apiUrl = "https://kf.fw199.com/gateway/eop/cats/list";

    Map<String, String> data = new HashMap<>();
    data.put("appid", Config.AppId);
    data.put("timestamp", String.valueOf(System.currentTimeMillis() / 1000));
    data.put("op", "3");
    data.put("parent_cid", "0");
    data.put("sign", Utils.Sign(data, Config.AppSecret));

    String result = doHttpRequest(apiUrl, data);
    System.out.println("result:" + result);
}

示例二:查询指定父类目下的子类目

@Test
public void eopCatsListChildren() throws Exception {

    String apiUrl = "https://kf.fw199.com/gateway/eop/cats/list";

    Map<String, String> data = new HashMap<>();
    data.put("appid", Config.AppId);
    data.put("timestamp", String.valueOf(System.currentTimeMillis() / 1000));
    data.put("op", "3");
    data.put("parent_cid", "1000000957"); // 上一级类目的 cid
    data.put("sign", Utils.Sign(data, Config.AppSecret));

    String result = doHttpRequest(apiUrl, data);
    System.out.println("result:" + result);
}

示例三:在父类目下按名称模糊搜索

@Test
public void eopCatsListByName() throws Exception {

    String apiUrl = "https://kf.fw199.com/gateway/eop/cats/list";

    Map<String, String> data = new HashMap<>();
    data.put("appid", Config.AppId);
    data.put("timestamp", String.valueOf(System.currentTimeMillis() / 1000));
    data.put("op", "8");
    data.put("parent_cid", "0");
     data.put("name", "鞋");
    data.put("sign", Utils.Sign(data, Config.AppSecret));

    String result = doHttpRequest(apiUrl, data);
    System.out.println("result:" + result);
}

四、返回结果

说明:

  • 最外层 code0 表示成功,非 0 为失败,message 包含失败原因
  • 成功时 data数组;无匹配记录时返回空数组 []
  • 鉴权失败、权限未开通、签名错误等场景不返回业务 data

4.1 成功示例

{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "cid": 1000000957,
      "is_parent": 1,
      "name": "鞋靴",
      "parent_cid": 0,
      "cats_level": 1,
      "full_ids": "1000000957",
      "full_name": "鞋靴"
    },
    {
      "cid": 1000001648,
      "is_parent": 1,
      "name": "办公用品",
      "parent_cid": 0,
      "cats_level": 1,
      "full_ids": "1000001648",
      "full_name": "办公用品"
    }
  ],
  "trace_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

4.2 data 数组元素字段说明

字段名 类型 说明
cid number 类目 ID,平台侧唯一(同一 op 下)
is_parent number 是否父节点:1 = 有子类目,0 = 叶子类目
name string 当前类目名称
parent_cid number 父类目 ID;一级类目为 0
cats_level number 类目层级,从 1 开始
full_ids string 类目全路径 ID,一般为各级 cid 用分隔符拼接
full_name string 类目全路径名称,如 鞋靴/男鞋/休闲鞋

4.3 失败示例

参数缺失:

{
  "code": 1,
  "message": "参数parent_cid不能为空"
}

签名失败:

{
  "code": 105,
  "message": "签名失败"
}

权限未开通:

{
  "code": 104,
  "message": "您没有开通此接口的权限,请联系客服"
}

余额不足 / 扣费失败:

{
  "code": 20,
  "message": "扣减费用失败,请联系客服"
}

五、常见错误码

code 说明
0 成功
1 业务参数错误(op / parent_cid 缺失或无效)
20 扣费失败
100 appid 为空
102 无效的 appid
103 账号待审核或权限校验失败
104 未开通 eop_cats_list 权限
105 签名失败
文档更新时间: 2026-08-22 22:31   作者:admin