请求 #
接口概述 #
获取平台全量商品类目树
请求URL #
GET {{host}}/cates
请求头(header) #
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| Authorization | string | 是 | token |
请求参数 #
无
请求示例 #
curl --location 'https://cmall.crrcgo.cc/capi/v1/cates' \
--header 'Authorization: YOZYVI-IGDYK3G5YULXXTUIBID9DS3CSRCL5MOZA'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://cmall.crrcgo.cc/capi/v1/cates',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: YOZYVI-IGDYK3G5YULXXTUIBID9DS3CSRCL5MOZA'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://cmall.crrcgo.cc/capi/v1/cates")
.method("GET", body)
.addHeader("Authorization", "YOZYVI-IGDYK3G5YULXXTUIBID9DS3CSRCL5MOZA")
.build();
Response response = client.newCall(request).execute();
响应 #
返回参数 #
| 参数名 | 类型 | 参数路径 | 说明 |
|---|---|---|---|
| code | int | 错误码 | |
| msg | string | 错误详情 | |
| data | array | 结果集 | |
| id | int | data | 类目ID |
| name | string | data | 类目名称 |
| parent_id | int | data | 父类目ID |
| level | int | data | 类目层级 |
| path | string | data | 类目路径 |
| sort | int | data | 排序 |
| children | array | data | 子类目 |
| id | int | children | 子类目ID |
| name | string | children | 子类目名称 |
| parent_id | int | children | 父类目ID |
| level | int | children | 类目层级 |
| sort | int | children | 排序 |
| path | string | children | 类目路径 |
响应示例 #
{
"code": 10000,
"msg": "success",
"data": [
{
"id": 1,
"name": "服装",
"parent_id": 0,
"path": "-",
"level": 1,
"sort": 1,
"children": [
{
"id": 2,
"name": "男装",
"parent_id": 1,
"path": "-1-",
"level": 2,
"sort": 1
},
{
"id": 3,
"name": "女装",
"parent_id": 1,
"path": "-1-",
"level": 2,
"sort": 2
}
]
}
]
}