宝博体育最新-宝博登录入口

咨询热线(同微信): 0778-766668803
河南某某机械制造有限公司 专注10年高精密机械零件加工

热门关键字:

您的位置: 主页 > 关于我们 > 产品及宗旨 >

澳洲飞跃 快递单号查询接口-快递鸟API

返回列表 来源:宝博登录入口 发布日期:2021-11-21 00:27
 本文摘要:前言看完快递鸟api澳洲飞跃对接教程这篇文章,把源码复制到项目上,就能快速完成接口对接,适合刚入门的菜鸟,挪用快递鸟的澳洲飞跃查询API接口,能查询到澳洲飞跃单号从收件、运输,到转运中心,派送到签收等各个环节的物流发货状态。快递鸟api接口不区离开发语言,支持Java,C#,PHP,Python,ObjectC等开发语言的法式挪用。

宝博体育最新

宝博体育最新

前言看完快递鸟api澳洲飞跃对接教程这篇文章,把源码复制到项目上,就能快速完成接口对接,适合刚入门的菜鸟,挪用快递鸟的澳洲飞跃查询API接口,能查询到澳洲飞跃单号从收件、运输,到转运中心,派送到签收等各个环节的物流发货状态。快递鸟api接口不区离开发语言,支持Java,C#,PHP,Python,ObjectC等开发语言的法式挪用。

下面详细解说实现历程.目录1.完成前期准备事情2.API接口3.请求参数(Headers)4.请求参数(Body)5.返回参数(Return)6.请求完整报文(示例)7.乐成返回报文(示例)8.失败返回报文(示例)9.无轨迹返回报文(示例)10.分步解说(C#版本)11.关于签名 1.完成前期准备事情1.1,去快递鸟官网免费注册一个账号1.2,免费获得一个apiKey(接口权限验证需要)1.3,完成实名认证流程1.4,订购一个免费套餐2.API接口2.1,测试挪用地址:http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json2.2,正式挪用地址:http://api.kdniao.com/api/dist2.3,请求方式:POST2.4,编码花样(utf-8):application/x-www-form-urlencoded;charset=utf-82.5,返回类型:JSON2.6,调试页面:http://kdniao.com/UserCenter/v2/SandBox/TrackQuery.aspx2.7,调试工具:去调试(使用快递鸟账号登录) 3.请求参数(Headers)参数名称类型说明必须要求RequestDataString请求内容需举行URL(utf-8)编码,请求内容JSON花样,须和DataType一致必填EBusinessIDString用户ID,检察用户ID和ApiKey必填RequestTypeString请求指令类型:1002 必填DataSignString签名数据,(Body+ApiKey)举行MD5加密,再举行Base64编码,最后举行URL(utf-8)编码必填DataTypeString求、返回数据类型:2-json ,默认Json选填4.请求参数(Body)参数名称类型说明必须要求OrderCodeString订单编号选填ShipperCodeString快递公司编码必填LogisticCodeString物流运单号必填 参数报文:{'OrderCode':'','ShipperCode':'RLG','LogisticCode':'RLG12361628'} 5.返回参数(Return)参数名称类型说明必须要求EBusinessIDString用户ID 必填ShipperCodeString快递公司编码 必填LogisticCodeString物流运单号选填SuccessString乐成与否必填ReasonString失败原因选填StateString物流状态:2-在途中,3-签收,4-问题件必填Traces String时间 AcceptTimeString 必填AcceptStationString形貌 选填RemarkString备注必填6.请求完整报文(示例)RequestData=%7b%27OrderCode%27%3a%27%27%2c%27ShipperCode%27%3a%27RLG%27%2c%27LogisticCode%27%3a%27RLG12361628%27%7d&EBusinessID=1264783&RequestType=1002&DataSign=NzliMWZlZmI4OGVjMjFlM2I3M2ZmYzBiMTQzMjJkN2E%3d&DataType=2 7.乐成返回报文(示例){"LogisticCode": "RLG12361628","ShipperCode": "RLG","Traces": [{"AcceptStation": "运单已建立信息已录入 ","AcceptTime": "2020-03-26 15:35:00"},{"AcceptStation": "货物已入仓 ","AcceptTime": "2020-03-26 19:37:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0327 ","AcceptTime": "2020-03-27 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0328 ","AcceptTime": "2020-03-28 13:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0329 ","AcceptTime": "2020-03-29 16:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0330 ","AcceptTime": "2020-03-30 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0331 ","AcceptTime": "2020-03-31 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0401 ","AcceptTime": "2020-04-01 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0402 ","AcceptTime": "2020-04-02 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0403 ","AcceptTime": "2020-04-03 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0404 ","AcceptTime": "2020-04-04 16:30:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0405 ","AcceptTime": "2020-04-05 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0406 ","AcceptTime": "2020-04-06 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0407 ","AcceptTime": "2020-04-07 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0408 ","AcceptTime": "2020-04-08 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0409 ","AcceptTime": "2020-04-09 14:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0410 ","AcceptTime": "2020-04-10 19:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0411 ","AcceptTime": "2020-04-11 11:00:00"},{"AcceptStation": "请尽快上传钱菁菁身份证0412 ","AcceptTime": "2020-04-12 11:15:00"},{"AcceptStation": "货物分拣中 ","AcceptTime": "2020-04-14 10:54:00"},{"AcceptStation": "货物安检中 ","AcceptTime": "2020-04-16 10:00:00"},{"AcceptStation": "货物离港 ","AcceptTime": "2020-04-18 11:43:00"},{"AcceptStation": "货物中转 ","AcceptTime": "2020-04-21 17:08:00"},{"AcceptStation": "货物抵达 ","AcceptTime": "2020-04-23 19:12:00"},{"AcceptStation": "货物进入海关羁系仓 ","AcceptTime": "2020-04-24 15:49:00"},{"AcceptStation": "货物开始清关等候放行 ","AcceptTime": "2020-04-26 09:00:00"},{"AcceptStation": "货物清关中,等候放行 ","AcceptTime": "2020-04-28 09:24:00"}],"State": "2","EBusinessID": "1264783","Success": true}8.失败返回报文(示例){"LogisticCode": "RLG12361628", "ShipperCode": "RLG", "Traces": [], "State": "0", "EBusinessID": "1264783", "Reason": "业务错误[没有可用套餐]", "Success": false }说明:未实名认证,未订购套餐,套餐可用查询量已经用完 都市返回此报文信息去实名认证 / 相识套餐详情9.无轨迹返回报文(示例){ "LogisticCode" : "1RLG12361628", "ShipperCode" : "RLG", "Traces" : [ ], "State" : "0", "EBusinessID" : "1264783", "Reason" : "暂无轨迹信息", "Success" : true } 10.分步解说(C#版本)10.1,请求数据包结构10.2,C#挪用代码示例//电商IDstring eEBusinessID = "test1617571"; //电商加密私钥,快递鸟提供,注意保管,不要泄漏string appKey= "554343b2-7252-439b-b4eb-1af42c8f2175"; //请求urlstring reqURL = "http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json";//请求指令 string reqType="1002";//2-json string dataType = "2"; //字符编码接纳UTF-8 string charset = "UTF-8"; //JSON字符串string string jsonStr = "{"OrderCode":"","ShipperCode":"JTSD","LogisticCode":"JT0000052600488"}" ;//把(jsonStr+APIKey)举行MD5加密string md5Str=MD5(jsonStr + apiKey, charset);//把md5Str 举行Base64编码string base64Str=base64(md5Str,charset);//举行URL编码 (utf-8)string datasign = HttpUtility.UrlEncode(base64Str, charset); //请求报文参数 string postStr = "RequestType=reqType&EBusinessID= eEBusinessID&RequestData=jsonStr &DataSign= datasign&DataType=dataType"; //通讯协议使用Http协议Post请求方式 返回轨迹数据string post = SendPost(reqURL, postStr);//获取到的post数据就是快递鸟返回的完整报文,接下来自己写一个剖析json的方法就能获取到内里的字段信息。10.3,C#挪用方法///<summary> /// 字符串MD5加密 ///</summary> ///<param name="str">要加密的字符串</param> ///<param name="charset">编码方式</param> ///<returns>密文</returns> private string MD5(string str, string charset) { byte[] buffer = System.Text.Encoding.GetEncoding(charset).GetBytes(str); try { System.Security.Cryptography.MD5CryptoServiceProvider check; check = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] somme = check.ComputeHash(buffer); string ret = ""; foreach (byte a in somme) { if (a < 16) ret += "0" + a.ToString("X"); else ret += a.ToString("X"); } return ret.ToLower(); } catch { throw; } } /// <summary> /// base64编码 /// </summary> /// <param name="str">内容</param> /// <param name="charset">编码方式</param> /// <returns></returns> private string base64(String str, String charset) { return Convert.ToBase64String(System.Text.Encoding.GetEncoding(charset).GetBytes(str));} /// <summary> /// Post方式提交数据,返回网页的源代码 /// </summary> /// <param name="url">发送请求的 URL</param> /// <param name="postData">请求报文参数</param> /// <returns>远程资源的响应效果</returns> private string SendPost(string url, string postData) { string result = ""; byte[] byteData = Encoding.GetEncoding("UTF-8").GetBytes(postData.ToString()); try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.ContentType = "application/x-www-form-urlencoded"; request.Referer = url; request.Accept = "*/*"; request.Timeout = 30 * 1000; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"; request.Method = "POST"; request.ContentLength = byteData.Length; Stream stream = request.GetRequestStream(); stream.Write(byteData, 0, byteData.Length); stream.Flush(); stream.Close(); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream backStream = response.GetResponseStream(); StreamReader sr = new StreamReader(backStream, Encoding.GetEncoding("UTF-8")); result = sr.ReadToEnd(); sr.Close(); backStream.Close(); response.Close(); request.Abort(); } catch (Exception ex) { result = ex.ToString(); } return result; } 11.关于签名快递鸟和第三方电子商务公司系统举行对接,有一定的宁静机制。

宝博体育最新

接纳 IP 认证加签名的方式对接,详细方案如下: 防止数据被窜改 在 POST 请求中会通报 5 个必须(R)参数 RequestData==数据内容(URL 编码:UTF-8) EBusinessID==用户 ID RequestType=请求指令类型 DataSign== 数据内容签名:把(请求内容(未编码)+ApiKey)举行 MD5 加密,然后 Base64 编码,最后举行 URL(utf-8)编码 DataType==2(返回数据类型为 json) 注:DataSign 生成后,对方吸收到数据后,以同样的算法举行签名(推送接口 RequestType 为 101/102 不需要举行 URL 编码),生成摘要,对比两者的摘要是否相同,如果差别,说明通报历程中发生数据窜改。挪用接口的身份认证 注册成为快递鸟用户后,会生成对应的用户 ID 和 APIKey,用户 ID 相当于用户名, APIKey 相当于密码。


本文关键词:澳洲,飞跃,快递,单号,查询,接口,鸟,API,前言,宝博体育最新

本文来源:宝博体育最新-www.jwgss.cn

【相关推荐】

全国服务热线

0778-766668803