淘宝/Tmall获得淘宝分类详情API返回值说明:
1.请求参数 (支持高并发请求接口)
请求参数:cid=16
参数说明:cid:商品分类ID,可以用cid=0来获得所有一级类目
2.请求公共参数:
名称 | 类型 | 必须 | 描述 |
---|---|---|---|
key | String | 是 | 调用key(必须以GET方式拼接在URL中,点击获取请求地址) |
secret | String | 是 | 调用密钥 (接口代码展示wechat 19970108018) |
api_name | String | 是 | API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等] |
cache | String | 否 | [yes,no]默认yes,将调用缓存的数据,速度比较快 |
result_type | String | 否 | [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读 |
lang | String | 否 | [cn,en,ru]翻译语言,默认cn简体中文 |
version | String | 否 | API版本 |
3.代码请求示例(CURL、PHP 、PHPsdk 、Java 、C# 、Python…)
# coding:utf-8
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
# 请求示例 url 默认请求参数已经做URL编码
url = "https://wx19970108018/taobao/cat_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&cid=16"
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)
4.代码响应示例
Result Object:
---------------------------------------
{
"items": {
"item": [
{
"id": "16",
"name": "女装/女士精品",
"pid": "2",
"root_id": "2",
"sub": [
{
"id": "1622",
"pid": "16",
"root_id": "16",
"name": "裤子",
"note": ""
},
{
"id": "1623",
"pid": "16",
"root_id": "16",
"name": "半身裙",
"note": ""
},
{
"id": "1624",
"pid": "16",
"root_id": "16",
"name": "套装/学生校服/工作制服",
"note": ""
},
{
"id": "1629",
"pid": "16",
"root_id": "16",
"name": "大码女装",
"note": ""
},
{
"id": "162103",
"pid": "16",
"root_id": "16",
"name": "毛衣",
"note": ""
},
{
"id": "162104",
"pid": "16",
"root_id": "16",
"name": "衬衫",
"note": ""
},
{
"id": "162116",
"pid": "16",
"root_id": "16",
"name": "蕾丝衫/雪纺衫",
"note": ""
},
{
"id": "162205",
"pid": "16",
"root_id": "16",
"name": "牛仔裤",
"note": ""
},
{
"id": "50000671",
"pid": "16",
"root_id": "16",
"name": "T恤",
"note": ""
},
{
"id": "50000697",
"pid": "16",
"root_id": "16",
"name": "毛针织衫",
"note": ""
},
{
"id": "50000852",
"pid": "16",
"root_id": "16",
"name": "中老年女装",
"note": ""
},
{
"id": "50008897",
"pid": "16",
"root_id": "16",
"name": "西装",
"note": ""
},
{
"id": "50008898",
"pid": "16",
"root_id": "16",
"name": "卫衣/绒衫",
"note": ""
},
{
"id": "50008899",
"pid": "16",
"root_id": "16",
"name": "羽绒服",
"note": ""
},
{
"id": "50008900",
"pid": "16",
"root_id": "16",
"name": "棉衣/棉服",
"note": ""
},
{
"id": "50008901",
"pid": "16",
"root_id": "16",
"name": "风衣",
"note": ""
},
{
"id": "50008904",
"pid": "16",
"root_id": "16",
"name": "皮衣",
"note": ""
},
{
"id": "50008905",
"pid": "16",
"root_id": "16",
"name": "皮草",
"note": ""
},
{
"id": "50008906",
"pid": "16",
"root_id": "16",
"name": "唐装/民族服装/舞台服装",
"note": ""
},
{
"id": "50010850",
"pid": "16",
"root_id": "16",
"name": "连衣裙",
"note": ""
},
{
"id": "50011277",
"pid": "16",
"root_id": "16",
"name": "短外套",
"note": ""
},
{
"id": "50011404",
"pid": "16",
"root_id": "16",
"name": "婚纱/旗袍/礼服",
"note": ""
},
{
"id": "50013194",
"pid": "16",
"root_id": "16",
"name": "毛呢外套",
"note": ""
},
{
"id": "50013196",
"pid": "16",
"root_id": "16",
"name": "马夹",
"note": ""
},
{
"id": "121412004",
"pid": "16",
"root_id": "16",
"name": "背心吊带",
"note": ""
},
{
"id": "121434004",
"pid": "16",
"root_id": "16",
"name": "抹胸",
"note": ""
},
{
"id": "201241307",
"pid": "16",
"root_id": "16",
"name": "POLO衫",
"note": ""
},
{
"id": "201247207",
"pid": "16",
"root_id": "16",
"name": "连体衣/裤",
"note": ""
}
]
}
]
},
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"error": "",
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:134 max:10100 all[271=134+64+73];expires:2030-12-31",
"execution_time": "0.066",
"server_time": "Beijing/2022-09-21 18:13:11",
"client_ip": "106.6.38.190",
"call_args": [],
"api_type": "taobao",
"translate_language": "zh-CN",
"translate_engine": "google_new",
"server_memory": "0.84MB",
"request_id": "gw-4.632ae3b716a2d",
"last_id": "1231547131"
}