API是应用程序的开发接口,在开发程序的时候,我们有些功能可能不需要从到到位去研发,我们可以拿现有的开发出来的功能模块来使用,而这个功能模块,就叫做库(libary)。比如说:要实现数据传输的安全,这就要使用加密技术,使用加密技术就要用到加密算法,而加密算法,已经有好心人,帮我们开发出来了加密算法库,你直接就可以调用,不需要再开发算法。这就相当于生产汽车,对于一个汽车来说,里面有各种各样的零部件,这个汽车厂家不可能所有的零部件都是自己生产的,如轮胎,很多厂家直接购买就可以了。
做软件也一样,有的软件,并不是所有的东西都是开发人员自己写的,可以调用现有的。所以说,程序与库之间是调用的关系。但是,要调用就要遵守开发规范(API)。
京东api接口,item_search_coupon - 优惠券查询
公共参数
名称 | 类型 | 必须 | 描述 |
---|---|---|---|
key | String | 是 | 调用key(必须以GET方式拼接在URL中) 注册Key和secret测试: https://o0b.cn/anzexi |
secret | String | 是 | 调用密钥 |
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输出的内容中文可以直接阅读18179014480 |
lang | String | 否 | [cn,en,ru]翻译语言,默认cn简体中文 |
version | String | 否 | API版本 |
请求参数
请求参数:num_iid=10335871600
参数说明:num_iid:JD商品ID
响应参数
{
"items": {
"item": [
{
"addDays": 0,
"anotherType": 0,
"applicability": true,
"area": 1,
"batchId": 994514437,
"beginTime": "2023.03.11",
"couponId": "994514437",
"couponKind": 2,
"couponStyle": 0,
"couponType": 1,
"discount": 120,
"discountText": "以下商品可使用满600减120的优惠券",
"encryptedKey": "g0ueidd5e72c01284635e5d70262661e",
"endTime": "2023.03.13",
"labelTxt": "店铺东券",
"limitType": 5,
"milliSecond": 0,
"multipleDiscount": false,
"name": "仅可购买安踏悠购专卖店商品",
"overlap": false,
"personalCoupon": false,
"platform": 0,
"plusCoupon": false,
"quota": 600,
"roleId": 102255202,
"timeDesc": "有效期2023-03-11至2023-03-13",
"toUrl": "mall.jd.com/index-213251.html",
"userRiskLevel": 5
},
{
"addDays": 0,
"anotherType": 0,
"applicability": true,
"area": 1,
"batchId": 994573393,
"beginTime": "2023.03.11",
"couponId": "994573393",
"couponKind": 2,
"couponStyle": 0,
"couponType": 1,
"discount": 100,
"discountText": "以下商品可使用满499减100的优惠券",
"encryptedKey": "g3uai9dbe8280e2547ce3b3b76c98109",
"endTime": "2023.03.13",
"labelTxt": "店铺东券",
"limitType": 5,
"milliSecond": 0,
"multipleDiscount": false,
"name": "仅可购买安踏悠购专卖店商品",
"overlap": false,
"personalCoupon": false,
"platform": 0,
"plusCoupon": false,
"quota": 499,
"roleId": 102255150,
"timeDesc": "有效期2023-03-11至2023-03-13",
"toUrl": "mall.jd.com/index-213251.html",
"userRiskLevel": 5
},
{
"addDays": 0,
"anotherType": 0,
"applicability": true,
"area": 1,
"batchId": 724892628,
"beginTime": "2023.03.11",
"couponId": "724892628",
"couponKind": 2,
"couponStyle": 0,
"couponType": 1,
"discount": 60,
"discountText": "以下商品可使用满400减60的优惠券",
"encryptedKey": "g7u5i2d8ef2f082743185b9565db86e3",
"endTime": "2023.03.13",
"labelTxt": "店铺东券",
"limitType": 5,
"milliSecond": 0,
"multipleDiscount": false,
"name": "仅可购买安踏悠购专卖店商品",
"overlap": false,
"personalCoupon": false,
"platform": 0,
"plusCoupon": false,
"quota": 400,
"roleId": 102255075,
"timeDesc": "有效期2023-03-11至2023-03-13",
"toUrl": "mall.jd.com/index-213251.html",
"userRiskLevel": 5
},
{
"addDays": 0,
"anotherType": 0,
"applicability": true,
"area": 1,
"batchId": 724814748,
"beginTime": "2023.03.11",
"couponId": "724814748",
"couponKind": 2,
"couponStyle": 0,
"couponType": 1,
"discount": 30,
"discountText": "以下商品可使用满300减30的优惠券",
"encryptedKey": "g5ufi6dde9280f2e4faded96c4d7949e",
"endTime": "2023.03.13",
"labelTxt": "店铺东券",
"limitType": 5,
"milliSecond": 0,
"multipleDiscount": false,
"name": "仅可购买安踏悠购专卖店商品",
"overlap": false,
"personalCoupon": false,
"platform": 0,
"plusCoupon": false,
"quota": 300,
"roleId": 102254976,
"timeDesc": "有效期2023-03-11至2023-03-13",
"toUrl": "mall.jd.com/index-213251.html",
"userRiskLevel": 5
},
{
"addDays": 0,
"anotherType": 0,
"applicability": true,
"area": 1,
"batchId": 994573249,
"beginTime": "2023.03.11",
"couponId": "994573249",
"couponKind": 2,
"couponStyle": 0,
"couponType": 1,
"discount": 10,
"discountText": "以下商品可使用满200减10的优惠券",
"encryptedKey": "g7u9i8dde52d0b2f42b201acf0ebb410",
"endTime": "2023.03.13",
"labelTxt": "店铺东券",
"limitType": 5,
"milliSecond": 0,
"multipleDiscount": false,
"name": "仅可购买安踏悠购专卖店商品",
"overlap": false,
"personalCoupon": false,
"platform": 0,
"plusCoupon": false,
"quota": 200,
"roleId": 102254895,
"timeDesc": "有效期2023-03-11至2023-03-13",
"toUrl": "mall.jd.com/index-213251.html",
"userRiskLevel": 5
},
{
"activityType": "15",
"customTag": [],
"link": "",
"proId": "133156566236",
"promoId": "133156566236",
"skuId": "",
"text": "满减",
"typeNumber": "15",
"value": "满169元减10元"
}
],
"price": {
"epp": "",
"hagglePromotion": false,
"id": "10335871600",
"m": "339.00",
"nup": "",
"op": "299.00",
"p": "179.00",
"plusTag": {
"limit": false,
"max": 0,
"min": 0,
"overlying": false
},
"pp": "",
"sdp": "",
"sfp": "",
"sp": "",
"tkp": "",
"tpp": ""
},
"title": "安踏男鞋休闲运动鞋春季新款网面透气轻便板鞋跑步鞋子户外训练旅游鞋 5527-7象牙白/雾灰-网面 42"
},