京东商品历史价格数据API接口可以帮助您获取京东商品的历史价格信息。通过该接口,您可以查询商品在不同时间点的价格,以便了解其价格走势和优惠活动。
要使用京东商品历史价格数据API接口,您需要先注册成为京东开放平台的开发者,并创建应用获取App Key和App Secret。然后,根据京东开放平台提供的开发文档,调用相应的API接口并传入必要的参数,例如商品ID、时间范围等。最后,解析返回的数据并进行进一步的处理或展示。
JD.item_history_price-获取商品历史价格信息)数据接口返回值说明
1.请求方式:HTTP POST GET; 复制Taobaoapi2014获取APISDK文件。
2.请求URL:c0b.cc/30G0f2
3.请求参数:
请求参数:num_iid=100033966459
参数说明:num_iid:商品id(可替换)
4.请求示例:
# coding:utf-8
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
# 请求示例 url 默认请求参数已经做URL编码
url = "api-gw.xxx.cn/jd/item_history_price/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=100033966459"
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)
5.返回示例
{
"items": {
"num_iid": "63153022346",
"title": "京东商城安踏女鞋跑步鞋女2020冬季新品轻便跑鞋皮面运动鞋子休闲鞋官方旗舰网店女子运动鞋子 (革面)藕灰-2 8.5(女40)",
"detail_url": "https://item.jd.com/63153022346.html",
"pic_url": "",
"lower_price": "",
"lower_date": "",
"current_price": "",
"change_price_remark": "",
"item": [
{
"date": "2021-02-24",
"price": "159.01",
"discount": ""
},
{
"date": "2021-02-25",
"price": "159.01",
"discount": ""
},
{
"date": "2021-02-26",
"price": "159.01",
"discount": ""
},
{
"date": "2021-02-27",
"price": "159.01",
"discount": ""
},
{
"date": "2021-02-28",
"price": "159.01",
"discount": ""
},
{
"date": "2021-03-01",
"price": "159.01",
"discount": ""
},
{
"date": "2021-03-02",
"price": "159.01",
"discount": ""
},
{
"date": "2021-03-03",
"price": "159.01",
"discount": ""
}
],
"data_from": "p_zwjhl"
},
"error": "",
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:15 max:10000",
"execution_time": 0.682,
"server_time": "Beijing/2021-03-10 16:34:02",
"client_ip": "106.6.35.144",
"call_args": [],
"api_type": "jd",
"translate_language": "zh-CN",
"translate_engine": "google_cn",
"server_memory": "3.11MB",
"request_id": "gw-1.6048847a39f60"
}
需要注意的是,使用京东商品历史价格数据API接口需要遵守相关的法律法规和平台规定,确保数据的合法性和合规性。同时,由于API调用可能会产生一定的费用,商家需要根据自己的需求和预算进行合理的使用。另外,为了确保获取的数据准确性和完整性,建议在使用API之前先进行必要的测试和验证。