API文档中心

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

淘宝联盟找同款比价、同类产品、SKU查询接口

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

本接口用于查询淘宝联盟商品比价产品——基于“同款商品SKU级”的比价。因此价格基本可以十分接近。同时,如果商品没有找到同款商品SKU商品列表,返回高近似的同类商品,价格也十分接近。

如果有需要在你的应用中展示的SKU的话,此API也可以查询商品的SKU。

本接口仅可用于淘客商品。


另外,接口不一定可以找到同款SKU价,请做好判断。做为替代,您可以用以下两个接口配合使用:

(1)找同款、高相似推荐、榜单宝贝接口:http://www.veapi.cn/apidoc/taobaolianmeng/88 该接口功能类似,但返回的产品相似精度没有本接口强。也不能返回SKU。

(2)淘宝客图像搜同款产品接口:http://www.veapi.cn/apidoc/taobaolianmeng/91 主要用于拍照搜索。基于主图找同款。

接口请求地址

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

请求方式:GETPOST

请求参数

参数名称 参数类型 必填 示例值 描述
vekey String V123M56 公共参数,接口秘钥,请在会员中心获取
id String V97yVbt6tnyvOGI7RKuvtV-8P9O0eCYO6PJg4Oiq6 商品ID,可以是数字ID,也可以是联盟字符串ID
restype Number 默认0 返回值类型。可选值0,1,2。默认0-只要sku,1-需要同款比价产品,2-sku和同款比价全要
relatedrecommend Number 默认0 是否返回同类商品,默认0不返回,可选值1返回

请求示例

  • HTTP
  • PHP
  • JAVA
  • PYTHON
GET/POST  http://api.veapi.cn/tbk/bihaohuo?vekey=xxx&restype=0&id=NOqMA8S5tVzRpPUZN7F0uB-Gegvkriqj3Wnnvvf9 

使用curl函数,curl不是php原生库,需要安装才能使用

$api="http://api.veapi.cn/tbk/bihaohuo?vekey=xxx&restype=0&id=NOqMA8S5tVzRpPUZN7F0uB-Gegvkriqj3Wnnvvf9";

$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/tbk/bihaohuo?vekey=xxx&restype=0&id=NOqMA8S5tVzRpPUZN7F0uB-Gegvkriqj3Wnnvvf9";
        // 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/tbk/bihaohuo?vekey=xxx&restype=0&id=NOqMA8S5tVzRpPUZN7F0uB-Gegvkriqj3Wnnvvf9"

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

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

返回值(JSON)

参数名称 参数类型 是否必选 示例值 描述
item Map   商品概要,有时不会返回该字段
 └─ shopLogo String否   https://img.alicdn.com/imgextra/i2/O1CN01wqVVFk2987yUgpgLV_!!6000000008022-2-tps-315-315.png 店铺商标
 └─ itemDefaultImageUrl String否   http://...jpg 产品默认主图
 └─ bcType String B 店铺类型,B-天猫,C淘宝
 └─ icItemTitle String xxx 商品标题
 └─ shopName String XX旗舰店 店铺名称
sku Map   SKU信息,如果为空,表示该产品无SKU
 └─ skuList List   SKU选项,可能有1-3组或更多,比如“床铺”,有“颜色款式”、“尺寸”、“框架结构”三组skuList,三种款式组合结果将在下面的skuBase字段体现最终价格。
    └─ valueId String 4247655158 SKU序列号
    └─ valueText String 【床板满铺】圆角款40高 带床垫 SKU序列名称
 └─ skuBase List   SKU组合,【特别说明】组合序列,比如1627207:4247655158;21433:50753410;122216927:77835123含义:可用“;”分割,可以看出有三组组合。表示skuList中1627207(比如颜色)的属性下4247655158对应项规格+21433属性下50753410对应项规格+122216927属性下77835123那款。
    └─ quantity Number 60000 库存
    └─ price Float 1956.5 该SKU组合价格
    └─ skuId Number 4154888156836 该SKU组合序列号
    └─ skuImage String //img.alicdn.com/i1/3065345479/3065345479.jpg SKU缩略图
    └─ skuProperty String 【床板满铺】圆角款40高 带床垫 + 1500mm*1900mm + 框架结构 SKU组合说明
sameSkuInfo List   SKU级比价商品列表
relatedRecommend List   同类产品

返回示例

【提示】推广链接通常有时效性,示例中的链接为创建文档时生成,仅用于展示返回结果使用,有可能已失效。
{ "error": "0", "msg": "获取成功!", "data": { "itemId": "NOqMA8S5tVzRpPUZN7F0uB-Gegvkriqj3Wnnvvf9", "item": { "shopLogo": "https://img.alicdn.com/imgextra/i2/O1CN01wqVVFk2987yUgpgLV_!!6000000008022-2-tps-315-315.png", "itemDefaultImageUrl": "//gju4.alicdn.com/tps/i1/3937219703/O1CN01OtmAdc2LY1pbaDAdC_!!3937219703-0-C2M.jpg", "bcType": "B", "icItemTitle": "棉签掏耳化妆用木棒棉花棒挖耳朵双头棉签棒一次性清洁棉棒2000支", "price": "2.5" }, "shopName": "天天特卖工厂店", "modifyTime": "11:00更新", "sku": { "skuList": [ { "propertyDetail": [ { "valueId": "13413083577", "valueText": "3包【300支装】", "selected": false }, { "valueId": "21247180436", "valueText": "12包【1200支装】", "selected": false }, { "valueId": "22186962932", "valueText": "优质款:20包【2000支装】", "selected": false }, { "valueId": "17447556230", "valueText": "6包【600支装】", "selected": false }, { "valueId": "22186962931", "valueText": "优质款:10包【1000支装】", "selected": false }, { "valueId": "5824334472", "valueText": "8包【800支装】", "selected": false }, { "valueId": "22186962933", "valueText": "优质款:1盒【500支】", "selected": false }, { "valueId": "13413083576", "valueText": "2包【200支装】", "selected": true }, { "valueId": "22186962930", "valueText": "优质款:5包【500支装】", "selected": false }, { "valueId": "1647960883", "valueText": "1包【100支装】", "selected": false }, { "valueId": "22186962934", "valueText": "优质款:2盒【1000支】", "selected": false }, { "valueId": "2258123526", "valueText": "15包【1500支装】", "selected": false }, { "valueId": "2258123528", "valueText": "10包【1000支装】", "selected": false }, { "valueId": "2258123525", "valueText": "20包【2000支装】", "selected": false }, { "valueId": "21306784938", "valueText": "20包【2000支装", "selected": false }, { "valueId": "22186962929", "valueText": "优质款:3包【300支装】", "selected": false }, { "valueId": "2258123524", "valueText": "5包【500支装】", "selected": false } ], "propertyText": "颜色分类", "propertyId": "1627207" } ], "skuBase": { "1627207:22186962930": { "quantity": "1653", "price": "5.1", "skuId": 5059629402483, "skuImage": "//img.alicdn.com/i2/3937219703/O1CN01sROkaY2LY1nykYPwc_!!3937219703.jpg", "skuProperty": "优质款:5包【500支装】" }, "1627207:17447556230": { "compareDesc": "天猫同款低价", "quantity": "424", "price": "4.49", "skuId": 5037119063794, "skuImage": "//img.alicdn.com/i1/3937219703/O1CN01HP4yI62LY1oyGdYfg_!!3937219703.jpg", "skuProperty": "6包【600支装】" }, "1627207:22186962931": { "quantity": "4194", "price": "6.8", "skuId": 5059629402484, "skuImage": "//img.alicdn.com/i3/3937219703/O1CN01OhzUee2LY1nzHatVF_!!3937219703.jpg", "skuProperty": "优质款:10包【1000支装】" }, "1627207:22186962932": { "quantity": "988", "price": "11.9", "skuId": 5059629402485, "skuImage": "//img.alicdn.com/i1/3937219703/O1CN01ZVARvT2LY1o5OlpWx_!!3937219703.jpg", "skuProperty": "优质款:20包【2000支装】" }, "1627207:21247180436": { "quantity": "2662", "price": "6.9", "skuId": 5037119063797, "skuImage": "//img.alicdn.com/i1/3937219703/O1CN01XDXexJ2LY1p7Fs5Y1_!!3937219703.jpg", "skuProperty": "12包【1200支装】" }, "1627207:22186962933": { "quantity": "421", "price": "7.88", "skuId": 5059629402486, "skuImage": "//img.alicdn.com/i4/3937219703/O1CN01uGag132LY1o48r6Tf_!!3937219703.jpg", "skuProperty": "优质款:1盒【500支】" }, "1627207:22186962934": { "quantity": "258", "price": "11.99", "skuId": 5059629402487, "skuImage": "//img.alicdn.com/i3/3937219703/O1CN01ZTMPOg2LY1nzHf7aI_!!3937219703.jpg", "skuProperty": "优质款:2盒【1000支】" }, "1627207:13413083576": { "compareDesc": "天猫同款低价", "quantity": "1156", "price": "2.5", "skuId": 4924759313821, "skuImage": "//img.alicdn.com/i3/3937219703/O1CN01xeU4b22LY1p1LOZ7q_!!3937219703.jpg", "skuProperty": "2包【200支装】" }, "1627207:13413083577": { "compareDesc": "全网同款低价", "quantity": "9314", "price": "3.1", "skuId": 5037119063792, "skuImage": "//img.alicdn.com/i4/3937219703/O1CN01NJSRHG2LY1p805acq_!!3937219703.jpg", "skuProperty": "3包【300支装】" }, "1627207:22186962929": { "quantity": "4074", "price": "3.3", "skuId": 5059629402482, "skuImage": "//img.alicdn.com/i2/3937219703/O1CN01mejYRv2LY1nzHb5vP_!!3937219703.jpg", "skuProperty": "优质款:3包【300支装】" }, "1627207:2258123528": { "compareDesc": "全网同款低价", "quantity": "1219", "price": "5.7", "skuId": 5037119063796, "skuImage": "//img.alicdn.com/i1/3937219703/O1CN01ifYeQy2LY1pA0zcBG_!!3937219703.jpg", "skuProperty": "10包【1000支装】" }, "1627207:5824334472": { "compareDesc": "全网同款低价", "quantity": "2968", "price": "5.29", "skuId": 5037119063795, "skuImage": "//img.alicdn.com/i2/3937219703/O1CN01VJAAqL2LY1pA0zkR2_!!3937219703.jpg", "skuProperty": "8包【800支装】" }, "1627207:2258123525": { "quantity": "578", "price": "9.8", "skuId": 5037119063799, "skuImage": "//img.alicdn.com/i3/3937219703/O1CN015x9QHn2LY1os9NXGs_!!3937219703.jpg", "skuProperty": "20包【2000支装】" }, "1627207:2258123526": { "compareDesc": "天猫同款低价", "quantity": "373", "price": "8.9", "skuId": 5037119063798, "skuImage": "//img.alicdn.com/i4/3937219703/O1CN01DQeYes2LY1os9LnBj_!!3937219703.jpg", "skuProperty": "15包【1500支装】" }, "1627207:21306784938": { "quantity": "5", "skuId": 4920116636747, "skuImage": "//img.alicdn.com/i4/3937219703/O1CN01WwnMfV2LY1mtqvNlD_!!3937219703.jpg", "skuProperty": "20包【2000支装" }, "1627207:2258123524": { "quantity": "9478", "price": "3.9", "skuId": 5037119063793, "skuImage": "//img.alicdn.com/i4/3937219703/O1CN01OuJuWp2LY1p6BKTgL_!!3937219703.jpg", "skuProperty": "5包【500支装】" }, "1627207:1647960883": { "quantity": "8788", "price": "2.22", "skuId": 5037119063791, "skuImage": "//img.alicdn.com/i3/3937219703/O1CN01MtHsSf2LY1p1LInE6_!!3937219703.jpg", "skuProperty": "1包【100支装】" } } } }, "request_id": "IvNfS4h" }

错误码

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

在线
客服

会员请加QQ群交流:

微信
咨询

加微信咨询
顶部