API文档中心

热门接口:产品ID找同款全量维权查询万能转链字符串ID转换 (有API需求可联系本站)

唯品会分类属性查询接口

调用权限:核心接口会员卡调用
接口使用场景等说明:

唯品会分类属性查询接口,用于用户根据分类ID、分类名获取类目信息

接口请求地址

环境 http 地址 https 地址
正式环境 http://api.veapi.cn/vip/vip_catedetail 暂无

请求方式:GETPOST

请求参数

参数名称 参数类型 必填 示例值 描述
vekey String V123M56 公共参数,接口秘钥,请在会员中心获取
category_id Integer 277 分类ID
category_name String   分类名称
limit Integer 默认0   限制最大返回数量,仅当category_name参数不为空时有效,默认0返回所有匹配的记录数;大于0,返回匹配的limit条记录数
only_leaf Boolean FALSE 是否只查leaf类目,仅当category_name参数不为空时有效
is_include_children Boolean 默认false 是否包含子级类目,和category_id参数配合使用。对参数category_name无效。

请求示例

  • HTTP
  • PHP
  • JAVA
  • PYTHON
GET/POST  http://api.veapi.cn/vip/vip_catedetail?vekey=xxx&category_id=277 
【例子】根据分类ID查询分类信息
http://api.veapi.cn/vip/vip_category?vekey=xxx&category_id=277
【例子】根据分类名查询分类信息
http://api.veapi.cn/vip/vip_category?vekey=xxx&category_name=男鞋
【例子】获取指定分类ID的属性,需添加参数cate_attr=1
http://api.veapi.cn/vip/vip_category?vekey=xxx&category_id=277&cate_attr=1
使用curl函数,curl不是php原生库,需要安装才能使用

$api="http://api.veapi.cn/vip/vip_catedetail?vekey=xxx&category_id=277";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api);
//curl_setopt($ch, CURLOPT_POST, true);  //POST方式时启用
//curl_setopt($ch, CURLOPT_POSTFIELDS, $postData );  //POST方式时传参

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  //如果使用https请启用
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);  //如果使用https请启用
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );   //返回数据流,不直接输出
curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); //使用gzip压缩传输让访问更快
curl_setopt($ch, CURLOPT_TIMEOUT, 6);  //允许执行的最长秒数。这里设定6S
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);

$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

echo $result; //返回值
使用okhttp3/httpclient/jsoup/hutool,以hutool为例:

import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpRequest;

public class testGetParam {

    public static void main(String[] args) {
        // API网址
        String url = "http://api.veapi.cn/vip/vip_catedetail?vekey=xxx&category_id=277";
        // JDK 8u111版本后,若目标页面为HTTPS协议,请启用proxy用户密码鉴权
        //System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");

        // 发送请求
        String result = HttpRequest.get(url)
                .timeout(10000)//设置超时,毫秒
                .execute().body();
        System.out.println(result);
    }
}
推荐使用 requests,支持访问http,https网页:

import requests
		
# 要访问的API网页
target_url = "http://api.veapi.cn/vip/vip_catedetail?vekey=xxx&category_id=277"

# 发送请求
response = requests.get(target_url)

# 获取页面内容
if response.status_code == 200:
	print response.text

返回值(JSON)

参数名称 参数类型 是否必选 示例值 描述
category_id Integer   分类ID
category_name String   分类名称
foreignname String {"en":"Anti-fatigue"} 分类名称外国名称,格式为JSON
description String   分类描述
category_type Categorytype   分类类型
keywords String   关键字
flags Long   标记位,用于后续扩展属性
hierarchy_id Integer   展示导航ID
last_updatetime Long   最后变更时间, 获取变更的节点接口使用
related_categories List   相关分类
attriute_id Integer   属性Id(注:attriute应为attribute)
attribute_name String   属性名称
foreignname String {"en":"Choice of Model"} 属性名称外国名称,格式为JSON
description String   属性说明
attribute_type Attributetype   属性类型:自然属性/Tag属性/分类特有属性
data_type Datatype   数据类型:文本/数值/选项
unit String   数值单位
sort Integer   排序因子
flags Long   属性标记位,条件属性
parent_attribute_id Integer   父属性ID,为0表示为独立属性,否则为依赖属性
attributeId Integer   属性ID
optionId Integer   选项ID
name String   选项名称
description String   选项描述
hierarchyGroup String   选项分组
sort Integer   排序因子
parentOptionId Integer   父选项ID,为0表示都独立选项,否则为依赖选项
isVirtual Boolean   是否为虚拟选项,虚拟选型是多个其它选型的聚合
realOptions List   如果是虚拟选项,这里是其它需要聚合的多个选项
foreignname String {"en":"Model 3"} 选项名称外国名称,格式为JSON
externaldata String   选项外部信息,格式为JSON
major_parent_category_id Integer   主父分类
salve_parent_category_ids List   非主父分类(注:salve应为slave)

返回示例

【提示】推广链接通常有时效性,示例中的链接为创建文档时生成,仅用于展示返回结果使用,有可能已失效。
{ "error": "0", "msg": "接口调用成功!", "data": { "hierarchy_id": 0, "last_updatetime": 0, "category_name": "男休闲鞋", "category_id": 277, "keywords": "男休闲鞋", "foreignname": "{\"en\":\"Men’s Casual Shoes\"}", "major_parent_category_id": 272, "description": "", "category_type": "LeafCategory" }, "request_id": "vIEfzi8" }

错误码

如果error不为0时,请点此查看错误码表格

在线
客服

会员请加QQ群交流:

微信
咨询

加微信咨询
顶部