Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the express order number logistics query interface general API

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to use the express order number logistics query interface general API, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.

The general API of express query interface is used by shippers to query the logistics track of express delivery. Before interface docking, you should go to the express bird website to apply for the interface key and APIKEY.

Application scenarios and uses of Express API

The most common application scenarios are as follows:

(1) E-commerce websites: for example, B2C, group buying, B2B, wholesale distribution stations, C2C, local life transactions and other websites.

(2) Management system: order processing platform, ordering platform, delivery platform, distribution system, channel management system, customer management system, ERP and so on.

The uses of express API are as follows:

(1) after letting the customer log on to the website, you can see the logistics status of the order directly on the "my order" page.

(2) automatically select the order numbers with the status of "signed" and "difficult documents", so as to reduce the pressure on the logistics personnel.

(3) change the status of the order and the transaction process, such as changing the order number to "signed", so that the order can be returned and exchanged.

(4) Evaluation and selection of express delivery companies, according to the number of "signed" waybills, the performance of the sales staff can be calculated, and it is easy to deal with the settlement.

(5) email and SMS remind users of the latest status of the waybill, which can not only appease the user, but also make use of email and SMS for secondary marketing.

Docking requirements:

(1) the query API supports querying according to the waybill number (a single query with no more than 10 / S).

(2), the designated logistics waybill number selects the corresponding express company code, the format is incorrect or the coding error will return the failure information. If the EMS logistics order number should choose the express company code (EMS)

(3) the returned logistics tracking information is arranged in ascending order according to the occurrence time.

(4), interface instruction 1002

(5) the interface is provided: express bird

(6) request address: http://www.kdniao.com

Example of java request:

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.security.MessageDigest;import java.util.HashMap;import java.util.Map / * * for more than 500 single queries per day, it is recommended to connect to the Logistics track subscription push API * * / public class KdniaoTrackQueryAPI {/ / DEMO public static void main (String [] args) {KdniaoTrackQueryAPI api = new KdniaoTrackQueryAPI (); try {String result = api.getOrderTracesByJson ("ANE", "210001633605"); System.out.print (result) } catch (Exception e) {e.printStackTrace ();}} / / E-commerce ID private String EBusinessID= "application"; / / E-commerce encrypts private key, be careful to keep it, do not disclose private String AppKey= "application"; / / request url private String ReqURL= "http://api.kdniao.cc/Ebusiness/EbusinessOrderHandle.aspx";" / * Json query order logistics track * @ throws Exception * / public String getOrderTracesByJson (String expCode, String expNo) throws Exception {String requestData= "{'OrderCode':'','ShipperCode':'" + expCode + "', 'LogisticCode':'" + expNo + "'}"; Map params = new HashMap () Params.put ("RequestData", urlEncoder (requestData, "UTF-8"); params.put ("EBusinessID", EBusinessID); params.put ("RequestType", "1002"); 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;} / * 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; i++) { 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()); } // flush输出流的缓冲 out.flush(); // 定义BufferedReader输入流来读取URL的响应 in = new BufferedReader( new InputStreamReader(conn.getInputStream(), "UTF-8")); String line; while ((line = in.readLine()) != null) { result.append(line); } } catch (Exception e) { e.printStackTrace(); } //使用finally块来关闭输出流、输入流 finally{ try{ if(out!=null){ out.close(); } if(in!=null){ in.close(); } } catch(IOException ex){ ex.printStackTrace(); } } return result.toString(); } private static char[] base64EncodeChars = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; public static String base64Encode(byte[] data) { StringBuffer sb = new StringBuffer(); int len = data.length; int i = 0; int b1, b2, b3; while (i < len) { b1 = data[i++] & 0xff; if (i == len) { sb.append(base64EncodeChars[b1 >

> > 2]); sb.append (base64EncodeChars [(b1 & 0x3) > > 2]); sb.append (base64EncodeChars [(b1 & 0x03) > 4)]); sb.append (base64EncodeChars [(b2 & 0x0f) > > 2]); sb.append (base64EncodeChars [(b1 & 0x03) > > 4)]; sb.append (base64EncodeChars [(b2 & 0x0f) > > 6)]) Sb.append (Base64EncodeCharts [b3 & 0x3f]);} return sb.toString ();}} Thank you for reading this article carefully. I hope the article "how to use the express order number logistics query interface General API" shared by the editor will be helpful to you. At the same time, I hope you will support us, pay attention to the industry information channel, and more related knowledge is waiting for you to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report