该接口可以查询商品相似推荐商品,方便我们在商品详情页展示相似商品,丰富产品内容,提高成交意向。
1、注册订单侠开放平台账号
注册地址: 用户注册
2、获取接口秘钥apikey
登录个人中心 - 系统设置 - 接口管理 找到接秘钥apikey,apikey 接口秘钥是调用接口的唯一凭证,请妥善保管!
3、PHP代码调用示例
<?php
// +----------------------------------------------------------------------
// | 订单侠开放平台 www.dingdanxia.com [ 专为淘客开发者提供一站式API解决方案 ]
// +----------------------------------------------------------------------
//接口秘钥
$apikey = '这里填写你的接口秘钥';
//京东相似推荐商品接口
$apiurl = "http://api.tbk.dingdanxia.com/jd/query_goods";
//开始调用
$result = curl_post($apiurl, array(
//接口秘钥
"apikey" => $apikey,
"skuIds" =>"29357345299",
//京东商品ID
'fields' =>'similar'
));
//打印结果
print_r($result);
/**
* post请求
* @param string $url
* @param array $params
* @param int $timeout
*/
function curl_post($url, $params, $timeout = 3) {
try {
foreach ($params as $key => $val) {
$post[] = "{$key}={$val}";
}
$post_data = implode('&', $post);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
return curl_exec($ch);
}
catch (Exception $e) {
return false;
}
}
4、接口返回结果
{
"code":200,
"msg":"请求成功【success】",
"total_results":1,
"similarSkuList":[
70038746547,
71501688811,
45725633628,
68488187464,
34543316784,
65552476111,
70619406615,
69597963233,
70238390138,
66996190520,
70682092911,
57756987603,
71137503114,
69649047933,
69540850889,
67797625253,
63849886413,
67796876629,
54585254010,
70491431911
],
"hotWords":"",
"data":[
{
"brandCode":"32315",
"brandName":"其他",
"categoryInfo":{
"cid1":6728,
"cid1Name":"汽车用品",
"cid2":6745,
"cid2Name":"汽车装饰",
"cid3":14914,
"cid3Name":"临时停车牌"
},
"comments":426957,
"commissionInfo":{
"commission":2.18,
"commissionShare":20,
"couponCommission":1.78,
"plusCommissionShare":20
},
"couponInfo":{
"couponList":[
{
"bindType":3,
"discount":2,
"getEndTime":1598975998000,
"getStartTime":1591499241000,
"hotValue":4,
"isBest":1,
"link":"https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeX6ZhWGwGTRZlqvwcLQpRq1bsaG2rdstUoCtlOBP8HOds5pFAaNAWpNRolenLjCiX2pNFcQ",
"platformType":0,
"quota":8,
"useEndTime":1598975999000,
"useStartTime":1591459200000
}
]
},
"goodCommentsShare":98,
"imageInfo":{
"imageList":[
{
"url":"http://img14.360buyimg.com/ads/jfs/t1/18321/24/127/392079/5c074ca0E9039d49c/081ed0cc9808b7ff.jpg"
},
{
"url":"http://img14.360buyimg.com/ads/jfs/t1/9878/13/7718/392079/5c074ca3E49d76fb7/9e342713c92fa19f.jpg"
},
{
"url":"http://img14.360buyimg.com/ads/jfs/t1/21374/21/121/392079/5c074ca8E7800a05b/fe33ad18e6b4ec1e.jpg"
},
{
"url":"http://img14.360buyimg.com/ads/jfs/t1/14927/20/106/392079/5c074ca9E66c21372/d1c2440f8218ab2f.jpg"
},
{
"url":"http://img14.360buyimg.com/ads/jfs/t1/14787/6/1048/392079/5c0f48deE85159f78/3c3196431b27c040.jpg"
}
]
},
"inOrderComm30Days":7307.75,
"inOrderCount30Days":7093,
"isHot":1,
"isJdSale":0,
"materialUrl":"item.jd.com/29357345299.html",
"owner":"p",
"pinGouInfo":[
],
"pingGouInfo":[
],
"priceInfo":{
"lowestCouponPrice":8.9,
"lowestPrice":10.9,
"lowestPriceType":1,
"price":10.9
},
"shopInfo":{
"shopId":795656,
"shopLevel":4,
"shopName":"安驰车品优创店"
},
"skuId":29357345299,
"skuName":"【立减2元,热卖40万件】临时停车牌挪车电话号码牌汽车用品车内饰品车上停车卡个性创意车载留言停车牌 T11停车牌【特价款】-黑色",
"spuid":28512212263,
"videoInfo":[
]
}
]
}
:::info
接口文档:关键词商品查询接口|京东关键词商品查询接口|京东关键词商品查询API|订单侠开放平台
在线测试:关键词商品查询接口|京东关键词商品查询接口|京东关键词商品查询API|订单侠开放平台
:::