获取淘宝商品类目API代码分享 淘宝商品全品类分类大全

252 阅读2分钟

cat_get-获得淘宝分类详情

item_cat_get-获得淘宝商品类目

公共参数

请求地址: o0b.cn/jennif

名称类型必须描述
keyString调用key(必须以GET方式拼接在URL中)
secretString调用密钥
api_nameStringAPI接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]
cacheString[yes,no]默认yes,将调用缓存的数据,速度比较快
result_typeString[json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读
langString[cn,en,ru]翻译语言,默认cn简体中文
versionStringAPI版本
  • 通用参数说明

    • 参数不要乱传,否则不管成功失败都会扣费
    • url说明 api-gw.onebound.cn/平台/API类型/ 平台:淘宝,京东等, API类型:[item_search,item_get,item_search_shop等]
    • version:API版本
    • key:调用key,测试key:test_api_key
    • secret:调用secret,测试secret:(不用填写)
    • cache:[yes,no]默认yes,将调用缓存的数据,速度比较快
    • result_type:[json,xml,serialize,var_export]返回数据格式,默认为json
    • lang:[cn,en,ru] 翻译语言,默认cn简体中文
    • secret:密钥

测试请先注册账号,点此注册

请求代码示例

// 请求示例 url 默认请求参数已经URL编码处理
// 本示例代码未加密secret参数明文传输,若要加密请参考:https://open.15870092527.cn/help/demo/sdk/demo-sign.php
$method = "GET";
$url = "https://服务器地址/taobao/cat_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&cid=16";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
var_dump(curl_exec($curl));
?>
响应示例
		"num_iid": "698291711589",
		"item_name": "美洋MEIYANG 大嫂的西装 内有乾坤~率性大气撞色TR垫肩直筒西服",
		"item_url": "https://item.taobao.com/item.htm?id=698291711589",
		"cat_id": 50008897,
		"root_cat_id": "",
		"cat_name": {
			"items": {
				"item": [
					{
						"id": "50008897",
						"name": "西装",
						"pid": "16",
						"root_id": "16",
						"sub": null
					}
				]
			}
		},
		"root_cat_name": {
			"items": {
				"item": [
					{
						"id": "1",
						"pid": "0",
						"root_id": "0",
						"name": "游戏话费",
						"note": "virtual"
					},
					{
						"id": "2",
						"pid": "0",
						"root_id": "0",
						"name": "服装鞋包",
						"note": "virtual"
					},
					{
						"id": "3",
						"pid": "0",
						"root_id": "0",
						"name": "手机数码",
						"note": "virtual"
					},
					{
						"id": "4",
						"pid": "0",
						"root_id": "0",
						"name": "家用电器",
						"note": "virtual"
					},
					{
						"id": "5",
						"pid": "0",
						"root_id": "0",
						"name": "美妆饰品",
						"note": "virtual"
					},
					{
						"id": "6",
						"pid": "0",
						"root_id": "0",
						"name": "母婴用品",
						"note": "virtual"
					},
					{
						"id": "7",
						"pid": "0",
						"root_id": "0",
						"name": "家居建材",
						"note": "virtual"
					},
					{
						"id": "8",
						"pid": "0",
						"root_id": "0",
						"name": "百货食品",
						"note": "virtual"
					},
					{
						"id": "9",
						"pid": "0",
						"root_id": "0",
						"name": "运动户外",
						"note": "virtual"
					},
					{
						"id": "10",
						"pid": "0",
						"root_id": "0",
						"name": "文化玩乐",
						"note": "virtual"
					},
					{
						"id": "13",
						"pid": "0",
						"root_id": "0",
						"name": "汽配摩托",
						"note": "virtual"
					},
					{
						"id": "98",
						"pid": "0",
						"root_id": "0",
						"name": "包装",
						"note": ""
					},
					{
						"id": "2128",
						"pid": "0",
						"root_id": "0",
						"name": "已删除",
						"note": ""
					},
					{
						"id": "50004958",
						"pid": "0",
						"root_id": "0",
						"name": "移动/联通/电信充值中心",
						"note": ""
					},
					{
						"id": "50007216",
						"pid": "0",
						"root_id": "0",
						"name": "鲜花速递/花卉仿真/绿植园艺",
						"note": ""
					},
					{
						"id": "50008075",
						"pid": "0",
						"root_id": "0",
						"name": "餐饮美食卡券",
						"note": ""
					},
					{
						"id": "50008141",
						"pid": "0",
						"root_id": "0",
						"name": "酒类",
						"note": ""
					},
					{
						"id": "50008907",
						"pid": "0",
						"root_id": "0",
						"name": "手机号码/套餐/增值业务",
						"note": ""
					},
					{
						"id": "50014811",
						"pid": "0",
						"root_id": "0",
						"name": "网店/网络服务/软件",
						"note": ""
					},
					{
						"id": "50014927",
						"pid": "0",
						"root_id": "0",
						"name": "教育培训",
						"note": ""
					},