In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about how to use the express bird logistics order number query api interface integration, the article is rich in content and professional analysis and description for you, I hope you can get something after reading this article.
With the development of online shopping, the express industry is also growing. The demand for express query interface docking is also increasing.
In the development of the project, some requirements will inevitably use some Api interfaces about express delivery; this article mainly introduces the query Api interface of express bird.
Achievable requirements:
Direct Integration of Api Interface for Express Logistics Information query in App
In the official account of Wechat, WeChat Mall and e-commerce website platform, according to the order number entered by the user, our backstage identifies the order number and queries the express Api interface according to the express bird, realizing the function of automatic query.
To log in, apply for users ID and API key
Application scenario
① buyer logistics inquiry: trajectory tracking, package progress, estimated delivery time, delivery contact information, etc.
② seller logistics tracking: whether it is out of range, transfer, multiple delivery, rejection
③ platform monitoring and management: fake transaction monitoring, matching seller delivery and customer confirmation of receiving time.
Demo can be implemented in multiple languages, taking javademo as an example:
Import java.io.BufferedReader;import java.io.IOException; import java.io.InputStreamReader;import java.io.OutputStreamWriter;import java.io.UnsupportedEncodingException;import java.net.HttpURLConnection;import java.net.URL;import java.net.URLEncoder;import java.util.HashMap;import java.util.Map;import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;import java.security.MessageDigest; public class KdGoldAPIDemo {/ / E-commerce ID private String EBusinessID= "1237100" / / E-commerce encrypted private key, provided by express bird, be careful to keep it, do not disclose (need to reapply for ID) private String AppKey= "518a73d8-1f7f-441a-b644-33e77b49d846"; / / request url private String ReqURL= "http://api.kdniao.cc/Ebusiness/EbusinessOrderHandle.aspx";" / * Json logistics information subscription * @ throws Exception * / public String orderTracesSubByJson () throws Exception {String requestData= "{'Code':' SF','Item': [" + "{'No':' 909261024507 / 'test'}," + "{' No': '589554393102' 'Bk':' test'}, "+" {'No':' 589522101958 "test'}," + "{'No':' 909198822942", "Bk': 'test'}" + "]}" Map params = new HashMap (); params.put ("RequestData", urlEncoder (requestData, "UTF-8"); params.put ("EBusinessID", EBusinessID); params.put ("RequestType", "1005"); String dataSign=encrypt (requestData, AppKey, "UTF-8"); params.put ("DataSign", urlEncoder (dataSign, "UTF-8")) Params.put ("DataType", "2"); String result=sendPost (ReqURL, params); / / the information returned according to the company's business processing. Return result XML Logistics Information subscription * @ throws Exception * / public String orderTracesSubByXml () throws Exception {String requestData= "+" + "SF" + "" + "+" 909261024507 "+" test "+" 909261024507 "+" test "+ "" + " Map params = new HashMap (); params.put ("RequestData", urlEncoder (requestData, "UTF-8"); params.put ("EBusinessID", EBusinessID); params.put ("RequestType", "1005"); String dataSign=encrypt (requestData, AppKey, "UTF-8"); params.put ("DataSign", urlEncoder (dataSign, "UTF-8")) Params.put ("DataType", "1"); String result=sendPost (ReqURL, params); / / the information returned according to the company's business processing. Return result;} / * MD5 encryption * @ param str content * @ param charset Encoding * @ throws Exception * / @ SuppressWarnings ("unused") private String MD5 (String str, String charset) throws Exception {MessageDigest md = MessageDigest.getInstance ("MD5"); md.update (str.getBytes (charset)); byte [] result = md.digest () StringBuffer sb = new StringBuffer (32); for (int I = 0; I < result.length; iTunes +) {int val = result [I] & 0xff; if (val 0) {param.append ("&");} param.append (entry.getKey ()) Param.append ("="); param.append (entry.getValue ()); System.out.println (entry.getKey () + ":" + entry.getValue ());} System.out.println ("param:" + param.toString ()) Out.write (param.toString ());} / / buffered out.flush () of the flush output stream; / / define the BufferedReader input stream to read the URL response in = new BufferedReader (new InputStreamReader (conn.getInputStream (), "UTF-8"); String line While ((line = in.readLine ())! = null) {result.append (line);}} catch (Exception e) {e.printStackTrace () } / / use the finally block to close the output stream and input stream finally {try {if (outdated invalid null) {out.close ();} if (inactive invalid null) {in.close () }} catch (IOException ex) {ex.printStackTrace ();}} return result.toString ();}} the above is how to use the express bird logistics order number query api interface to be integrated. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.