一、京东推荐商品列表API接口-(item_recommend-获取推荐商品列表API接口),京东API接口代码对接如下:
1.请求参数:
名称 | 类型 | 必须 | 描述 |
---|---|---|---|
key | String | 是 | 调用key(必须以GET方式拼接在URL中) |
secret | String | 是 | 调用密钥 (点击获取测试key和secret) |
api_name | String | 是 | API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等] |
cache | String | 否 | [yes,no]默认yes,将调用缓存的数据,速度比较快 |
result_type | String | 否 | [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读 |
lang | String | 否 | [cn,en,ru]翻译语言,默认cn简体中文 |
version | String | 否 | API版本 |
2.请求链接
请求参数:type=
参数说明:type:推荐类型
3.响应参数:
名称 | 类型 | 是否隐私 | 示例值 | 描述 |
---|---|---|---|---|
items | items[] | 获取推荐商品列表 | ||
num_iid | Bigint | 10021415166448 | 宝贝ID | |
detail_url | String | https://item.jd.com/10021415166448.html | 商品详情页 | |
title | String | 俞兆林2件装半高领打底衫秋冬长袖洋气纯色内衣内搭上衣黑色薄款女士秋衣女春秋保暖内衣女针织衫 黑色+浅卡其(80-130斤) | 商品标题 | |
pic_url | String | //img13.360buyimg.com/n7/jfs/t1/115150/13/17438/307259/5f58be2fE727cfb0d/aa76563060a56420.png | 宝贝图片 | |
price | Float | 188 | 价格 | |
promotion_price | Float | 188 | 优惠价 | |
sales | Int | 销量 | ||
sample_id | Bigint | 商品风格标识ID | ||
post_fee | Float | 物流费用 | ||
area | String | 店铺所在地 | ||
seller | String | 俞兆林YZL旗舰店 | 卖家昵称 |
4.请求示例(CURL、PHP 、PHPsdk 、Java 、C# 、Python…)
# coding:utf-8
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
# 请求示例 url 默认请求参数已经做URL编码
url = "https://wx19970108018/jd/item_recommend/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&type="
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)
5.响应示例
{
"url": "https://search.jd.com/Search?keyword=手链&enc=utf-8&wq=手链&pvid=33dbb420d9fa4ca483a869f2e4c5625c",
"keyword": "手链",
"page": "",
"real_total_results": "885843",
"total_results": 6000,
"pagecount": 100,
"products_total": "",
"list_count": "",
"page_size": "60",
"item": [
{
"num_iid": "68567099335",
"detail_url": "https://item.jd.com/68567099335.html",
"title": "【镶嵌施华洛世奇锆】四叶草手链女银项链生日礼物女生送老婆女友女朋友情侣白色情人节礼品S925纯银新婚 四叶草手链【镶嵌施华洛世奇锆】+独角...",
"pic_url": "//img10.360buyimg.com/n7/jfs/t1/142952/34/20594/98681/5fe939f8E9bc3285d/0e4c1a84241a68ac.jpg",
"price": 199,
"promotion_price": 199,
"sales": null,
"sample_id": "",
"post_fee": "",
"area": "",
"seller": "礼意久久专卖店"
},
{
"num_iid": "40906757975",
"detail_url&