当前位置:网站首页>透过案例看清API接口的作用——演示1688商品详情接口
透过案例看清API接口的作用——演示1688商品详情接口
2022-08-02 17:35:00 【分享干货的猫】
注册获取专属于你的key和secret
一、首先要了解api接口是什么
1.API是什么?
API应用程序接口(API:application programming interface),是一组定义、程序及协议的集合,通过API接口实现计算机软件之间的相互通信。API的一个主要功能是提供通用功能集。程序员通过使用API函数开发应用程序,从未避免编写无用程序,以减轻编程任务。API同时也是一种中间件,为各种不同平台提供数据共享。
通俗的说就是:API实际就是一种程序接口,就像你的电脑主机上有usb接口、低音炮接口、麦克风接口、显示器接口等等,一套程序也要有这么一个接口一边开发更多的功能。API接口的扩展性很强,程序员能够用它给原有程序增加很多功能。web2.0型网站大多会开放API,以便使懂得编程的网友开发出丰富的功能,从未达到完善服务的目的。
2.API说明文档是什么?
API说明文档是使用(iava API doc),其中包括所有接口和实体的说明使用。可以在浏览器下使用,方便用户的使用。使用时,打开docs目录下index.html文件即可。
3.API分为四种类型
(1)远程过程调用(RPC):通过作用在共享数据缓存器上的过程(或任务)实现程序间的通信。
(2)标准查询语言(SQL)是标准的访问数据的查询语言,通过通用数据库实现应用程序间数据共享。
(3)文件传输:文件传输通过发送格式化文件实现应用程序间数据共享。
(4)信息交付:指松耦合或紧耦合应用程序间的小型格式化信息,通过程序间的直接通信实现数据共享。
4、API提供方式
这是一种实时获取数据的方式,也是时下最好的方式。这种方式的流程是:数据提供一组API(可以使Java、C++、webservice等方式),供数据接收方使用。数据接收方根据自己的需求,填写相应的参数,通过调用API可以直接从数据供应商那里获得及时、最新的数据。
二、接口演示——1688商品详情接口
前往注册开启免费测试
为了进行此平台API的调用,首先我们需要做下面几件事情。
1、 首先需要通过注册获取专属的key
2、 参考API文档里的接入方式和示例。
3、查看测试工具是否有需要的接口,响应实例的返回字段是否符合参数要求。
4、利用平台的文档中心和API测试工具,对接口进行测试、程序获取
请求参数
请求参数:num_iid=652014604299
参数说明:num_iid:1688商品ID
sales_data:&sales_data=1 获取近30天成交数据
agent:&agent=1 获取1688分销代发价格数据
请求示例
-- 请求示例 url 默认请求参数已经URL编码处理 curl -i "https://api-gw.onebound.cn/1688/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=610947572360"
Request address:
https://api-gw.onebound.cn/1688/item_get/?key=注册获取&
&num_iid=652014604299&&lang=zh-CN&secret=注册获取
---------------------------------------
Result Object:
---------------------------------------
{
"item": {
"num_iid": "652014604299",
"title": "风衣外套女款小个子时尚东大门2022新款春秋垂感外套女装风衣批发",
"desc_short": "",
"price": "308.00",
"total_price": 0,
"suggestive_price": 0,
"orginal_price": "318.00",
"nick": "Lee show ming实力旗舰店",
"num": "1774",
"detail_url": "https://detail.1688.com/offer/652014604299.html",
"pic_url": "https://cbu01.alicdn.com/img/ibank/O1CN01AZIpo120s5B49MgJn_!!2208347006904-0-cib.jpg",
"brand": "",
"brandId": "",
"rootCatId": "10166",
"cid": "319",
"desc": "<div id=\"offer-template-0\"></div><p><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01caNBpT20s5CkdZXZH_!!2208347006904-0-cib.jpg?__r__=1657679771488\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01VkLgv920s5CtIoptg_!!2208347006904-0-cib.jpg?__r__=1657679771488\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01wVuvMO20s5CkdcDtS_!!2208347006904-0-cib.jpg?__r__=1657679771488\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01hr2Ley20s5Cs50ow6_!!2208347006904-0-cib.jpg?__r__=1657679771488\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01TBq9mG20s5Cn0RjFY_!!2208347006904-0-cib.jpg?__r__=1657679771488\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01RKhavh20s5CbAATJ4_!!2208347006904-0-cib.jpg?__r__=1657679771489\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN013WRPcF20s5CiKa6cB_!!2208347006904-0-cib.jpg?__r__=1657679771489\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01Rls8Sr20s5Cg2aV1o_!!2208347006904-0-cib.jpg?__r__=1657679771489\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01cgBF9y20s5Cn0QaYg_!!2208347006904-0-cib.jpg?__r__=1657679771489\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01kuT9aM20s5CrILSmZ_!!2208347006904-0-cib.jpg?__r__=1657679771489\" alt=\"undefined\"/></p>\r\n<p><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01PEFGBF20s5Cs52UwI_!!2208347006904-0-cib.jpg?__r__=1657679791807\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01nvdG0z20s5CbAC9K0_!!2208347006904-0-cib.jpg?__r__=1657679791807\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01CdCMqj20s5CkdctYf_!!2208347006904-0-cib.jpg?__r__=1657679791807\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01GG52MQ20s5CkkadkW_!!2208347006904-0-cib.jpg?__r__=1657679791807\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN013a5iRA20s5ChZphwR_!!2208347006904-0-cib.jpg?__r__=1657679791808\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN015MOP2R20s5CtIrvIg_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01JBibtW20s5Cg2dWJm_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01wUoodX20s5CrIPgvo_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01bTYClX20s5CiKc3LA_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01BVHp9s20s5ClS6yYK_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01zm97EY20s5Cn0SwH2_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01XDMqpz20s5CrIP5W1_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN01uZiVcz20s5CpFwWQy_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/><img src=\"https://cbu01.alicdn.com/img/ibank/O1CN013vnl8620s5ChZqNb4_!!2208347006904-0-cib.jpg?__r__=1657679818216\" alt=\"undefined\"/></p><img src=\"https://www.o0b.cn/i.php?t.png&rid=gw-1.62e8c51595335&p=1778787198&k=i_key&t=1659421974\" style=\"display:none\" />",
"item_imgs": [
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01AZIpo120s5B49MgJn_!!2208347006904-0-cib.jpg"
},
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01iA3tQQ20s5ApqTh4w_!!2208347006904-0-cib.jpg"
},
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01dJdIkt20s5B0oII27_!!2208347006904-0-cib.jpg"
},
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01e69Ct120s5AzrOVor_!!2208347006904-0-cib.jpg"
},
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01YUp5XX1Bs2lHTcJ8y_!!0-0-cib.jpg"
},
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01pA6liv20s58ZUKjeD_!!2208347006904-0-cib.jpg"
},
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN019MPZGs20s595GwIla_!!2208347006904-0-cib.jpg"
},
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01PaqyeD20s591X4GRt_!!2208347006904-0-cib.jpg"
},
{
"url": "https://cbu01.alicdn.com/img/ibank/O1CN019eICov20s58TyCzpB_!!2208347006904-0-cib.jpg"
}
],
"item_weight": "",
"post_fee": 10,
"express_fee": "",
"ems_fee": "",
"shipping_to": "",
"video": null,
"sample_id": "",
"props_name": "0:0:黑色;0:1:米色;0:2:深米色;0:3:浅米色;1:0:均码",
"prop_imgs": {
"prop_img": [
{
"properties": "0:0",
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01pA6liv20s58ZUKjeD_!!2208347006904-0-cib.jpg"
},
{
"properties": "0:1",
"url": "https://cbu01.alicdn.com/img/ibank/O1CN019eICov20s58TyCzpB_!!2208347006904-0-cib.jpg"
},
{
"properties": "0:2",
"url": "https://cbu01.alicdn.com/img/ibank/O1CN01PaqyeD20s591X4GRt_!!2208347006904-0-cib.jpg"
},
{
"properties": "0:3",
"url": "https://cbu01.alicdn.com/img/ibank/O1CN019MPZGs20s595GwIla_!!2208347006904-0-cib.jpg"
}
]
},
"property_alias": "0:0:黑色;0:1:米色;0:2:深米色;0:3:浅米色;1:0:均码",
"props": [
{
"name": "货号",
"show": false,
"value": "07808TC"
},
{
"name": "品牌",
"show": false,
"value": "Lee show ming"
},
{
"name": "面料名称",
"show": false,
"value": "棉"
},
{
"name": "主面料成分",
"show": false,
"value": "棉"
},
{
"name": "主面料成分2",
"show": false,
"value": "醋酯纤维"
},
{
"name": "图案",
"show": false,
"value": "纯色"
},
{
"name": "厚薄",
"show": false,
"value": "中等"
},
{
"name": "版型",
"show": false,
"value": "直筒型"
},
{
"name": "衣长",
"show": false,
"value": "中长款(65cm<衣长≤80cm)"
},
{
"name": "领型",
"show": false,
"value": "翻领"
},
{
"name": "袖长",
"show": false,
"value": "长袖"
},
{
"name": "流行元素",
"show": false,
"value": "口袋"
},
{
"name": "工艺",
"show": false,
"value": "免烫处理"
},
{
"name": "上市年份/季节",
"show": false,
"value": "2022年秋季"
},
{
"name": "颜色",
"show": false,
"value": "黑色,米色,深米色,浅米色"
},
{
"name": "尺码",
"show": false,
"value": "均码"
},
{
"name": "风格类型",
"show": false,
"value": "气质通勤"
},
{
"name": "袖型",
"show": false,
"value": "常规袖"
},
{
"name": "门襟",
"show": false,
"value": "双排扣"
},
{
"name": "主面料成分含量",
"show": false,
"value": "50%(不含)-70%(含)"
},
{
"name": "风格",
"show": false,
"value": "都市风,英伦风,优雅风,通勤风,知性风"
},
{
"name": "是否跨境货源",
"show": false,
"value": "否"
},
{
"name": "主面料成分2含量",
"show": false,
"value": "50%(不含)-70%(含)"
}
],
"total_sold": null,
"scale": "",
"sellUnit": "件",
"skus": {
"sku": [
{
"price": "318.00",
"total_price": 0,
"sales": "0",
"properties": "0:0;1:0",
"properties_name": "0:0:颜色:黑色;1:0:尺码:均码",
"quantity": "519",
"sku_id": "4879016278070",
"spec_id": "7ccb9e57d1d5f349172254f5c3eb0f3e"
},
{
"price": "318.00",
"total_price": 0,
"sales": "0",
"properties": "0:1;1:0",
"properties_name": "0:1:颜色:米色;1:0:尺码:均码",
"quantity": "450",
"sku_id": "4879016278071",
"spec_id": "53865acdf0df3b493e458fedeb1185a7"
},
{
"price": "318.00",
"total_price": 0,
"sales": "0",
"properties": "0:2;1:0",
"properties_name": "0:2:颜色:深米色;1:0:尺码:均码",
"quantity": "365",
"sku_id": "4908340799409",
"spec_id": "93c307db4d7136f0c5d146ae8cb2f5ce"
},
{
"price": "318.00",
"total_price": 0,
"sales": "0",
"properties": "0:3;1:0",
"properties_name": "0:3:颜色:浅米色;1:0:尺码:均码",
"quantity": "440",
"sku_id": "4908340799410",
"spec_id": "22be0585d6eff09f8b45734aa18ba6e5"
}
]
},
"seller_id": "2208347006904",
"sales": 307,
"shop_id": "2208347006904",
"props_list": {
"0:0": "颜色:黑色",
"0:1": "颜色:米色",
"0:2": "颜色:深米色",
"0:3": "颜色:浅米色",
"1:0": "尺码:均码"
},
"seller_info": {
"nick": "Lee show ming实力旗舰店",
"user_num_id": "2208347006904",
"sid": "b2b-2208347006904ae848",
"title": "Lee show ming实力旗舰店",
"zhuy": "https://winport.m.1688.com/page/index.html?memberId=b2b-2208347006904ae848",
"shop_name": "Lee show ming实力旗舰店"
},
"tmall": "",
"data_from": "1688app",
"error": "",
"unit": null,
"is_support_mix": "true",
"mix_amount": "50",
"mix_begin": "0",
"mix_number": "2147483647",
"min_num": "2",
"props_img": {
"0:0": "https://cbu01.alicdn.com/img/ibank/O1CN01pA6liv20s58ZUKjeD_!!2208347006904-0-cib.jpg",
"0:1": "https://cbu01.alicdn.com/img/ibank/O1CN019eICov20s58TyCzpB_!!2208347006904-0-cib.jpg",
"0:2": "https://cbu01.alicdn.com/img/ibank/O1CN01PaqyeD20s591X4GRt_!!2208347006904-0-cib.jpg",
"0:3": "https://cbu01.alicdn.com/img/ibank/O1CN019MPZGs20s595GwIla_!!2208347006904-0-cib.jpg"
},
"location": "辽宁省 大连市",
"priceRange": [
[
"2",
"318.00"
],
[
"10",
"308.00"
]
],
"priceRangeOriginal": [],
"sales_info": {
"seller_num": "",
"repeat_rate_purchase": "",
"per_capita_purchases": "",
"comment_num": "",
"comment_url": ""
},
"format_check": "ok",
"desc_img": [
"https://cbu01.alicdn.com/img/ibank/O1CN01caNBpT20s5CkdZXZH_!!2208347006904-0-cib.jpg?__r__=1657679771488",
"https://cbu01.alicdn.com/img/ibank/O1CN01VkLgv920s5CtIoptg_!!2208347006904-0-cib.jpg?__r__=1657679771488",
"https://cbu01.alicdn.com/img/ibank/O1CN01wVuvMO20s5CkdcDtS_!!2208347006904-0-cib.jpg?__r__=1657679771488",
"https://cbu01.alicdn.com/img/ibank/O1CN01hr2Ley20s5Cs50ow6_!!2208347006904-0-cib.jpg?__r__=1657679771488",
"https://cbu01.alicdn.com/img/ibank/O1CN01TBq9mG20s5Cn0RjFY_!!2208347006904-0-cib.jpg?__r__=1657679771488",
"https://cbu01.alicdn.com/img/ibank/O1CN01RKhavh20s5CbAATJ4_!!2208347006904-0-cib.jpg?__r__=1657679771489",
"https://cbu01.alicdn.com/img/ibank/O1CN013WRPcF20s5CiKa6cB_!!2208347006904-0-cib.jpg?__r__=1657679771489",
"https://cbu01.alicdn.com/img/ibank/O1CN01Rls8Sr20s5Cg2aV1o_!!2208347006904-0-cib.jpg?__r__=1657679771489",
"https://cbu01.alicdn.com/img/ibank/O1CN01cgBF9y20s5Cn0QaYg_!!2208347006904-0-cib.jpg?__r__=1657679771489",
"https://cbu01.alicdn.com/img/ibank/O1CN01kuT9aM20s5CrILSmZ_!!2208347006904-0-cib.jpg?__r__=1657679771489",
"https://cbu01.alicdn.com/img/ibank/O1CN01PEFGBF20s5Cs52UwI_!!2208347006904-0-cib.jpg?__r__=1657679791807",
"https://cbu01.alicdn.com/img/ibank/O1CN01nvdG0z20s5CbAC9K0_!!2208347006904-0-cib.jpg?__r__=1657679791807",
"https://cbu01.alicdn.com/img/ibank/O1CN01CdCMqj20s5CkdctYf_!!2208347006904-0-cib.jpg?__r__=1657679791807",
"https://cbu01.alicdn.com/img/ibank/O1CN01GG52MQ20s5CkkadkW_!!2208347006904-0-cib.jpg?__r__=1657679791807",
"https://cbu01.alicdn.com/img/ibank/O1CN013a5iRA20s5ChZphwR_!!2208347006904-0-cib.jpg?__r__=1657679791808",
"https://cbu01.alicdn.com/img/ibank/O1CN015MOP2R20s5CtIrvIg_!!2208347006904-0-cib.jpg?__r__=1657679818216",
"https://cbu01.alicdn.com/img/ibank/O1CN01JBibtW20s5Cg2dWJm_!!2208347006904-0-cib.jpg?__r__=1657679818216",
"https://cbu01.alicdn.com/img/ibank/O1CN01wUoodX20s5CrIPgvo_!!2208347006904-0-cib.jpg?__r__=1657679818216",
"https://cbu01.alicdn.com/img/ibank/O1CN01bTYClX20s5CiKc3LA_!!2208347006904-0-cib.jpg?__r__=1657679818216",
"https://cbu01.alicdn.com/img/ibank/O1CN01BVHp9s20s5ClS6yYK_!!2208347006904-0-cib.jpg?__r__=1657679818216",
"https://cbu01.alicdn.com/img/ibank/O1CN01zm97EY20s5Cn0SwH2_!!2208347006904-0-cib.jpg?__r__=1657679818216",
"https://cbu01.alicdn.com/img/ibank/O1CN01XDMqpz20s5CrIP5W1_!!2208347006904-0-cib.jpg?__r__=1657679818216",
"https://cbu01.alicdn.com/img/ibank/O1CN01uZiVcz20s5CpFwWQy_!!2208347006904-0-cib.jpg?__r__=1657679818216",
"https://cbu01.alicdn.com/img/ibank/O1CN013vnl8620s5ChZqNb4_!!2208347006904-0-cib.jpg?__r__=1657679818216"
],
"shop_item": [],
"relate_items": []
},
"error": "",
"secache": "55ae58e80fe99c9b05e20b12d832cd3f",
"secache_time": 1659421974,
"secache_date": "2022-08-02 14:32:54",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:100 max:10100 all[168=100+30+38];expires:2030-12-31",
"execution_time": "1.337",
"server_time": "Beijing/2022-08-02 14:32:54",
"client_ip": "106.6.35.126",
"call_args": {
"num_iid": "652014604299"
},
"api_type": "1688",
"translate_language": "zh-CN",
"translate_engine": "google_new",
"server_memory": "3.99MB",
"request_id": "gw-1.62e8c51595335",
"last_id": "1122992565"
}
边栏推荐
猜你喜欢
npm install 编译时报“Cannot read properties of null (reading ‘pickAlgorithm‘)“
mui中使用多级选择器实现省市区联动
阿波罗 planning代码-modules\planning\lattice\trajectory_generation\PiecewiseBrakingTrajectoryGenerator类详解
Flink Learning 9: Configure the idea to develop the flink-Scala program environment
redis总结_多级缓存
字节面试官狂问我:你没有高并发、性能调优经验,为什么录取你?
NeRF:火爆科研圈的三维重建技术大揭秘
我用这一招让团队的开发效率提升了 100%!
The days of patching are more difficult than the days of writing code
打补丁的日子,比写代码的日子难熬多了
随机推荐
Mini Program Graduation Works WeChat Gymnasium Reservation Mini Program Graduation Design Finished Product (8) Graduation Design Thesis Template
Go 语言快速入门指南:第二篇 变量与常量
电烙铁的基础知识
阿里云关系型数据库RDS是干嘛额?
LeetCode·76.最小覆盖子串·滑动窗口
ffmpeg编译后找不到libx264
Redis的使用--集群模式
navicat creates a connection 2002-can't connect to server on localhost (10061) and the mysql service has started the problem
一朵“云“如何带来产业新变革
如何生成随机数+原理详细分析
golang源码分析(13)gorpc源码分析
LeetCode·每日一题·
KunlunBase 1.0 is released!
天翼云4.0分布式云赋能千行百业数字化转型
小程序毕设作品之微信体育馆预约小程序毕业设计成品(7)中期检查报告
npm install 编译时报“Cannot read properties of null (reading ‘pickAlgorithm‘)“
新特性解读 | MySQL 8.0 GIPK 不可见主键
Navicat for mysql cracked versions installed
Local broadcast MSE fragments mp4 service
Kubernetes:(七)优化大法(江湖失传已久的武林秘籍)