京东联盟高级API - 京东联盟商品类目查询接口

根据商品的父类目id查询子类目id信息,通常用获取各级类目对应关系,以便将推广商品归类。业务参数parentId、grade都输入0可查询所有一级类目ID,之后再用其作为parentId查询其子类目。

1、注册订单侠开放平台账号

注册地址: https://www.dingdanxia.com/user/register/index.html  

2、获取接口秘钥apikey

登录个人中心 - 系统设置 - 接口管理 找到接秘钥apikey,apikey 接口秘钥是调用接口的唯一凭证,请妥善保管! 
 

3、PHP代码调用示例

<?php
// +----------------------------------------------------------------------
// | 订单侠开放平台 www.dingdanxia.com  [ 专为淘客开发者提供一站式API解决方案 ] 
// +----------------------------------------------------------------------
//接口秘钥
$apikey = '这里填写你的接口秘钥';
//京东联盟商品类目查询接口
$apiurl = "http://api.tbk.dingdanxia.com/jd/goods_category";
 
 
//开始调用
$result = curl_post($apiurl, array(
    //接口秘钥
        "apikey"     => $apikey,
        "parentId"    =>0,
        "grade"       =>0,
        
));
 
 
//打印结果
print_r($result);
 
/**
 * post请求
 * @param string $url
 * @param array $params
 * @param int $timeout
 */
function curl_post($url, $params, $timeout = 3) {
    try {
        foreach ($params as $key => $val) {
            $post[] = "{$key}={$val}";
        }
        $post_data  = implode('&', $post);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
        return curl_exec($ch);
    }
    catch (Exception $e) {
        return false;
    }
}

 

4、接口返回结果


{
    "code":200,
    "msg":"请求成功【success】",
    "data":[
        {
            "grade":0,
            "name":"数码",
            "id":652,
            "parentId":0
        },
        {
            "grade":0,
            "name":"电脑、办公",
            "id":670,
            "parentId":0
        },
        {
            "grade":0,
            "name":"家用电器",
            "id":737,
            "parentId":0
        },
        {
            "grade":0,
            "name":"食品饮料",
            "id":1320,
            "parentId":0
        },
        {
            "grade":0,
            "name":"服饰内衣",
            "id":1315,
            "parentId":0
        },
        {
            "grade":0,
            "name":"美妆护肤",
            "id":1316,
            "parentId":0
        },
        {
            "grade":0,
            "name":"运动户外",
            "id":1318,
            "parentId":0
        },
        {
            "grade":0,
            "name":"母婴",
            "id":1319,
            "parentId":0
        },
        {
            "grade":0,
            "name":"家居日用",
            "id":1620,
            "parentId":0
        },
        {
            "grade":0,
            "name":"图书",
            "id":1713,
            "parentId":0
        },
        {
            "grade":0,
            "name":"礼品",
            "id":1672,
            "parentId":0
        },
        {
            "grade":0,
            "name":"文娱",
            "id":4053,
            "parentId":0
        },
        {
            "grade":0,
            "name":"本地生活/旅游出行",
            "id":4938,
            "parentId":0
        },
        {
            "grade":0,
            "name":"钟表",
            "id":5025,
            "parentId":0
        },
        {
            "grade":0,
            "name":"数字内容",
            "id":5272,
            "parentId":0
        },
        {
            "grade":0,
            "name":"厨具",
            "id":6196,
            "parentId":0
        },
        {
            "grade":0,
            "name":"珠宝首饰",
            "id":6144,
            "parentId":0
        },
        {
            "grade":0,
            "name":"玩具乐器",
            "id":6233,
            "parentId":0
        },
        {
            "grade":0,
            "name":"宠物生活",
            "id":6994,
            "parentId":0
        },
        {
            "grade":0,
            "name":"汽车用品",
            "id":6728,
            "parentId":0
        },
        {
            "grade":0,
            "name":"医疗保健",
            "id":9192,
            "parentId":0
        },
        {
            "grade":0,
            "name":"家装建材",
            "id":9855,
            "parentId":0
        },
        {
            "grade":0,
            "name":"家具",
            "id":9847,
            "parentId":0
        },
        {
            "grade":0,
            "name":"手机通讯",
            "id":9987,
            "parentId":0
        },
        {
            "grade":0,
            "name":"鞋靴",
            "id":11729,
            "parentId":0
        },
        {
            "grade":0,
            "name":"生鲜",
            "id":12218,
            "parentId":0
        },
        {
            "grade":0,
            "name":"酒类",
            "id":12259,
            "parentId":0
        },
        {
            "grade":0,
            "name":"团购",
            "id":12367,
            "parentId":0
        },
        {
            "grade":0,
            "name":"汽车",
            "id":12379,
            "parentId":0
        },
        {
            "grade":0,
            "name":"农资园艺",
            "id":12473,
            "parentId":0
        },
        {
            "grade":0,
            "name":"医药",
            "id":13314,
            "parentId":0
        },
        {
            "grade":0,
            "name":"教育培训",
            "id":13678,
            "parentId":0
        },
        {
            "grade":0,
            "name":"二手商品",
            "id":13765,
            "parentId":0
        },
        {
            "grade":0,
            "name":"邮币",
            "id":13887,
            "parentId":0
        },
        {
            "grade":0,
            "name":"IP",
            "id":13996,
            "parentId":0
        },
        {
            "grade":0,
            "name":"工业品",
            "id":14065,
            "parentId":0
        },
        {
            "grade":0,
            "name":"房地产",
            "id":15083,
            "parentId":0
        },
        {
            "grade":0,
            "name":"艺术品",
            "id":15126,
            "parentId":0
        },
        {
            "grade":0,
            "name":"家纺",
            "id":15248,
            "parentId":0
        },
        {
            "grade":0,
            "name":"家庭清洁/纸品",
            "id":15901,
            "parentId":0
        },
        {
            "grade":0,
            "name":"京东服务",
            "id":15980,
            "parentId":0
        },
        {
            "grade":0,
            "name":"个人护理",
            "id":16750,
            "parentId":0
        },
        {
            "grade":0,
            "name":"箱包皮具",
            "id":17329,
            "parentId":0
        },
        {
            "grade":0,
            "name":"非遗",
            "id":18528,
            "parentId":0
        }
    ]
}

接口文档:https://www.dingdanxia.com/doc/96/94

在线测试:https://www.dingdanxia.com/apitest/96/94

实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值