该接口可以查询商品相似推荐商品,方便我们在商品详情页展示相似商品,丰富产品内容,提高成交意向。

1、注册订单侠开放平台账号

注册地址: 用户注册

2、获取接口秘钥apikey

登录个人中心 - 系统设置 - 接口管理 找到接秘钥apikey,apikey 接口秘钥是调用接口的唯一凭证,请妥善保管!

3、PHP代码调用示例

  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 订单侠开放平台 www.dingdanxia.com [ 专为淘客开发者提供一站式API解决方案 ]
  4. // +----------------------------------------------------------------------
  5. //接口秘钥
  6. $apikey = '这里填写你的接口秘钥';
  7. //京东相似推荐商品接口
  8. $apiurl = "http://api.tbk.dingdanxia.com/jd/query_goods";
  9. //开始调用
  10. $result = curl_post($apiurl, array(
  11. //接口秘钥
  12. "apikey" => $apikey,
  13. "skuIds" =>"29357345299",
  14. //京东商品ID
  15. 'fields' =>'similar'
  16. ));
  17. //打印结果
  18. print_r($result);
  19. /**
  20. * post请求
  21. * @param string $url
  22. * @param array $params
  23. * @param int $timeout
  24. */
  25. function curl_post($url, $params, $timeout = 3) {
  26. try {
  27. foreach ($params as $key => $val) {
  28. $post[] = "{$key}={$val}";
  29. }
  30. $post_data = implode('&', $post);
  31. $ch = curl_init();
  32. curl_setopt($ch, CURLOPT_URL, $url);
  33. curl_setopt($ch, CURLOPT_POST, 1);
  34. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  35. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  36. curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  37. return curl_exec($ch);
  38. }
  39. catch (Exception $e) {
  40. return false;
  41. }
  42. }

4、接口返回结果

  1. {
  2. "code":200,
  3. "msg":"请求成功【success】",
  4. "total_results":1,
  5. "similarSkuList":[
  6. 70038746547,
  7. 71501688811,
  8. 45725633628,
  9. 68488187464,
  10. 34543316784,
  11. 65552476111,
  12. 70619406615,
  13. 69597963233,
  14. 70238390138,
  15. 66996190520,
  16. 70682092911,
  17. 57756987603,
  18. 71137503114,
  19. 69649047933,
  20. 69540850889,
  21. 67797625253,
  22. 63849886413,
  23. 67796876629,
  24. 54585254010,
  25. 70491431911
  26. ],
  27. "hotWords":"",
  28. "data":[
  29. {
  30. "brandCode":"32315",
  31. "brandName":"其他",
  32. "categoryInfo":{
  33. "cid1":6728,
  34. "cid1Name":"汽车用品",
  35. "cid2":6745,
  36. "cid2Name":"汽车装饰",
  37. "cid3":14914,
  38. "cid3Name":"临时停车牌"
  39. },
  40. "comments":426957,
  41. "commissionInfo":{
  42. "commission":2.18,
  43. "commissionShare":20,
  44. "couponCommission":1.78,
  45. "plusCommissionShare":20
  46. },
  47. "couponInfo":{
  48. "couponList":[
  49. {
  50. "bindType":3,
  51. "discount":2,
  52. "getEndTime":1598975998000,
  53. "getStartTime":1591499241000,
  54. "hotValue":4,
  55. "isBest":1,
  56. "link":"https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeX6ZhWGwGTRZlqvwcLQpRq1bsaG2rdstUoCtlOBP8HOds5pFAaNAWpNRolenLjCiX2pNFcQ",
  57. "platformType":0,
  58. "quota":8,
  59. "useEndTime":1598975999000,
  60. "useStartTime":1591459200000
  61. }
  62. ]
  63. },
  64. "goodCommentsShare":98,
  65. "imageInfo":{
  66. "imageList":[
  67. {
  68. "url":"http://img14.360buyimg.com/ads/jfs/t1/18321/24/127/392079/5c074ca0E9039d49c/081ed0cc9808b7ff.jpg"
  69. },
  70. {
  71. "url":"http://img14.360buyimg.com/ads/jfs/t1/9878/13/7718/392079/5c074ca3E49d76fb7/9e342713c92fa19f.jpg"
  72. },
  73. {
  74. "url":"http://img14.360buyimg.com/ads/jfs/t1/21374/21/121/392079/5c074ca8E7800a05b/fe33ad18e6b4ec1e.jpg"
  75. },
  76. {
  77. "url":"http://img14.360buyimg.com/ads/jfs/t1/14927/20/106/392079/5c074ca9E66c21372/d1c2440f8218ab2f.jpg"
  78. },
  79. {
  80. "url":"http://img14.360buyimg.com/ads/jfs/t1/14787/6/1048/392079/5c0f48deE85159f78/3c3196431b27c040.jpg"
  81. }
  82. ]
  83. },
  84. "inOrderComm30Days":7307.75,
  85. "inOrderCount30Days":7093,
  86. "isHot":1,
  87. "isJdSale":0,
  88. "materialUrl":"item.jd.com/29357345299.html",
  89. "owner":"p",
  90. "pinGouInfo":[
  91. ],
  92. "pingGouInfo":[
  93. ],
  94. "priceInfo":{
  95. "lowestCouponPrice":8.9,
  96. "lowestPrice":10.9,
  97. "lowestPriceType":1,
  98. "price":10.9
  99. },
  100. "shopInfo":{
  101. "shopId":795656,
  102. "shopLevel":4,
  103. "shopName":"安驰车品优创店"
  104. },
  105. "skuId":29357345299,
  106. "skuName":"【立减2元,热卖40万件】临时停车牌挪车电话号码牌汽车用品车内饰品车上停车卡个性创意车载留言停车牌 T11停车牌【特价款】-黑色",
  107. "spuid":28512212263,
  108. "videoInfo":[
  109. ]
  110. }
  111. ]
  112. }

:::info 接口文档:关键词商品查询接口|京东关键词商品查询接口|京东关键词商品查询API|订单侠开放平台
在线测试:关键词商品查询接口|京东关键词商品查询接口|京东关键词商品查询API|订单侠开放平台 :::