阿里巴巴中国站获得1688商品分类 API

一、参数

公共参数

请求地址: https://api-gw.onebound.cn/1688/cat_get

名称 类型 必须 描述
key String 调用key(必须以GET方式拼接在URL中)
secret String 调用密钥
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版本

请求参数

请求参数:cid=0

参数说明:cid:商品分类ID,可以用cid=0来获得所有一级类目

响应参数

Version: Date:

名称 类型 必须 示例值 描述

itmes

itmes[] 0 1688商品分类

id

Int 0 54 商品分类ID

name

String 0 服饰配件、饰品 分类名

pid

String 0 0 父分类ID

root_id

String 0 0 根分类ID

二、示例

请求示例

  • Curl
  • PHP
  • PHPsdk
  • JAVA
  • C#
  • Python
&secret=<您自己的apiSecret>&cid=0";
$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));
?>

  前往获取key和secret

响应示例

{
	"itmes": {
		"itme": [
			{
				"id": 312,
				"name": "内衣",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 54,
				"name": "服饰配件、饰品",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 10166,
				"name": "女装",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 2,
				"name": "食品酒水",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 122916001,
				"name": "宠物及园艺",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 122916002,
				"name": "汽车用品",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 58,
				"name": "灯饰照明",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 10165,
				"name": "男装",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 57,
				"name": "电子元器件",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 53,
				"name": "传媒、广电",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 70,
				"name": "安全、防护",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 68,
				"name": "包装",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 67,
				"name": "办公、文化",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 7,
				"name": "数码、电脑",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 5,
				"name": "电工电气",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 4,
				"name": "纺织、皮革",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 311,
				"name": "童装",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 1038378,
				"name": "鞋",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 1042954,
				"name": "箱包皮具",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 65,
				"name": "机械及行业设备",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 59,
				"name": "五金、工具",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 8,
				"name": "化工",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 55,
				"name": "橡塑",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 201346017,
				"name": "建材",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 64,
				"name": "环保",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 10208,
				"name": "仪器仪表",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 15,
				"name": "日用百货",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 1501,
				"name": "母婴用品",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 96,
				"name": "家纺家饰",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 97,
				"name": "美容护肤/彩妆",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 6,
				"name": "家用电器",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 13,
				"name": "家装建材",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 12,
				"name": "交通运输",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 17,
				"name": "工艺品、礼品",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 10,
				"name": "能源",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 1,
				"name": "农业",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 71,
				"name": "汽摩及配件",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 509,
				"name": "通信产品",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 1813,
				"name": "玩具",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 9,
				"name": "冶金矿产",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 66,
				"name": "医药、保养",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 72,
				"name": "印刷",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 18,
				"name": "运动户外",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 1426,
				"name": "机床",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 69,
				"name": "商务服务",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 2829,
				"name": "二手设备转让",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 2805,
				"name": "加工",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 130822220,
				"name": "个护/家清",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 130823000,
				"name": "性保健品",
				"pid": 0,
				"root_id": 0
			},
			{
				"id": 130822002,
				"name": "餐饮生鲜",
				"pid": 0,
				"root_id": 0
			}
		]
	},
	"translate_status": "",
	"translate_time": 0,
	"language": {
		"default_lang": "cn",
		"current_lang": "cn"
	},
	"error": "",
	"reason": "",
	"error_code": "0000",
	"cache": 0,
	"api_info": "today:5 max:10000",
	"execution_time": 0.608,
	"server_time": "Beijing/2021-03-05 11:58:51",
	"client_ip": "106.6.39.197",
	"call_args": [],
	"api_type": "1688",
	"translate_language": "zh-CN",
	"translate_engine": "google_cn",
	"server_memory": "3.52MB",
	"request_id": "gw-3.6041ac7b2705c"
}

异常示例

{
  "error": "item-not-found",
  "reason": "商品没找到",
  "error_code": "2000",
  "success": 0,
  "cache": 0,
  "api_info": "today:0 max:10000",
  "execution_time": 0.081,
  "server_time": "Beijing/2020-06-10 23:44:00",
  "call_args": [],
  "api_type": "taobao",
  "request_id": "15ee0ffc041242"}

三、错误码解释

状态代码(error_code) 状态信息 详细描述 是否收费
0000 success 接口调用成功并返回相关数据
2000 Search success but no result 接口访问成功,但是搜索没有结果
4000 Server internal error 服务器内部错误
4001 Network error 网络错误
4002 Target server error 目标服务器错误
4003 Param error 用户输入参数错误 忽略
4004 Account not found 用户帐号不存在 忽略
4005 Invalid authentication credentials 授权失败 忽略
4006 API stopped 您的当前API已停用 忽略
4007 Account stopped 您的账户已停用 忽略
4008 API rate limit exceeded 并发已达上限 忽略
4009 API maintenance API维护中 忽略
4010 API not found with these values API不存在 忽略
4012 Please add api first 请先添加api 忽略
4013 Number of calls exceeded 调用次数超限 忽略
4014 Missing url param 参数缺失 忽略
4015 Wrong pageToken 参数pageToken有误 忽略
4016 Insufficient balance 余额不足 忽略
4017 timeout error 请求超时
5000 unknown error 未知错误

你可能感兴趣的:(网站搭建,api,api接口,服务器,servlet,运维,api接口,api)