E-commerce ERP How to access the Express bird electronic surface single API?

Source: Internet
Author: User
Tags md5 encryption

Express Bird is a global logistics interface service provider, for e-commerce ERP, e-commerce platform, Warehousing, customs clearance company to provide logistics tracking, electronic surface, smart choice Logistics, logistics finance, online orders and other services to solve the e-commerce Logistics Management module and financial module. Now on the Express bird electronic surface single API to do a basic description, and provide electronic surface single interface docking method.
I. Interface Introduction
Express Bird Electronic Surface single interface to support the four-way, Shun Fung, EMS, home emergency delivery, Darbond, excellent speed, such as 15 of the domestic common express printing surface. Through the Express bird interface to print electronic waybill online, instantly generate waybill number, no need to record a single, improve delivery efficiency, improve delivery aging. The printing speed increases 4-6 times, eliminates the record single link, cancels the extraction single link, acts as the pickup order, enhances the delivery time limitation.

Traditional face-to-surface vs e-form:

Compare Items Traditional Noodle Sheet Electronic face sheet
Error rate High Low
Print speed (sheets/min) 4~6 30~40
Noise High Low
Cost of recording a single Up to 0
Machine Cost (RMB/set) 800~1200 900~1000
Information on the face sheet The handwriting is not clear Standardized printing
If a backfill number is required Is No backfill required, system generated waybill number directly backfill

Current e-form vs express bird e-form

Compare Items current E-form Express Bird Electronic surface single
Single volume requirements (PCS/month) Generally more than 1000 0
Monthly checkout Number Need to apply No account required
Do I need to buy an advance number? Some courier companies need Instant ticket application, no advance purchase required


Two. Java Docking method
(1) Electronic Surface single interface is a courier bird to provide independent e-commerce, warehousing management systems, logistics and supply chain logistics system platform for the use of the next single interface.
(2) For customers to solve the online delivery needs, merchants through the network Select Courier Company sent a request to inform The courier company has express to be shipped.
(3) The customer forwarded the data through this interface to The Courier bird, by the Courier bird for you to arrange the Courier home Pickup service.
(4) The order number (Ordercode) cannot be submitted repeatedly, the system will return the specific error code.
(5) The message received by the interface is HTTP POST, the encoding format of the request method (Utf-8): "Application/x-www-form-urlencoded;charset=utf-8".
(6) Request system-level parameter description:

Parameter name type Description must require
RequestData String The request content needs to be URL (utf-8) encoded. Request content JSON format, must be consistent with datatype. R
Ebusinessid String Merchant ID, please view it on the My Services page. R
RequestType String Request Instruction Type:1007 R
Datasign String Data content Signature: The (Request content (not encoded) +appkey) is MD5 encrypted, then BASE64 encoded, and finally the URL (utf-8) encoding. Please check the demo for detailed procedures. R
DataType String Request, return data type: Only JSON format is supported O
Note: R-Required (Required), O-selectable (Optional), C-message This parameter is optional (Conditional) under certain conditions.


(7) interface address:
API Test Address: Http://testapi.kdniao.cc:8081/api/EOrderService
API Official Address: Http://api.kdniao.cc/api/EOrderService


(8) Request Content field definition

Parameter name type Description whether you must
CallBack String User-definable callback information O
MemberID String Member ID O
CustomerName String e-Form customer account (with Express network application) O
Customerpwd String E-Face single password O
Sendsite String Collection dot Identification O
Shippercode String Express Company Code R
Logisticcode String Courier Number O
Ordercode String Order number R
Monthcode String Monthly Knot Code C
PayType Int Postage Payment method: 1-Pay, 2-to-pay, 3-monthly, 4-third-party payment R
Exptype String Courier Type: 1-Standard Express R
Isnotice Int Whether to notify the Courier to the door: 0-no notice; 1-notification; default is 1 O
Cost Double Shipment fee (Freight) O
Othercost Double Other fees O
Receiver Company String Recipient Company O
Name String Recipient R
Tel String Telephone and mobile phone, must fill in one R
Mobile String
Postcode String Recipient postcode O
Provincename String Recipient province (e.g. Guangdong province, do not lack "province") R
CityName String Recipient city (such as Shenzhen city, do not lack of "city") R
Expareaname String Inbox (such as Futian District, do not lack "zone" or "county") O
Address String Recipient Detail Address R
Sender Company String Sender Company O
Name String Sender R
Tel String Telephone and mobile phone, must fill in one R
Mobile String
Postcode String Sender ZIP Code O
Provincename String Send a province (such as Guangdong province, do not lack the "province") R
CityName String Send a city (such as Shenzhen city, do not lack of "city") R
Expareaname String Outbox (such as Futian District, do not lack "zone" or "county") O
Address String Sender Detail Address R
StartDate String On-Site pickup time: "YYYY-MM-DD HH:mm:ss" format, all time formats in this article are the same O
EndDate String O
Weight Double Item total weight kg O
Quantity Int Number of pieces/packages O
Volume Double Total volume of items m3 O
Remark String Note O
Addservices
AddService Name String Value Added service name O
Value String Value-Added service values O
CustomerID String Customer identification (optional) O
Commoditys
Commodity Goodsname String Product Name R
Goodscode String Product Code O
Goodsquantity Int Number of goods O
Goodsprice Double Commodity price O
Goodsweight Double Product weight kg O
Goodsdesc String Product Description O
Goodsvol Double Product Volume m3 O
Isreturnprinttemplate String Return e-form template: 0-not required; 1-Required O

(9) Return parameter definition

Parameter name type Description must require
Ebusinessid String User ID R
Order Ordercode String Order number R
Shippercode String Express Company Code R
Logisticcode String Courier Number R
Markdestination String Big Head Pen O
Origincode String Origin area code O
Originname String Origin/Origin Location O
Destinatiocode String Destination Area code O
Destinationame String Destination/Arrival Network O
Sortingcode String Sorting code O
PackageCode String Package encoding O
Success Bool Success or not R
ResultCode String Error encoding R
Reason String Reason for failure O
Uniquerrequestnumber String Uniquely identifies R
Printtemplate String Face Print Template O
Estimateddeliverytime String Order Estimated arrival time Yyyy-mm-dd O
Callback String User-definable callback information O

(Ten) Java docking example

Note: The secret key needs to apply to the Express bird website

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; /** * * Express Bird Electronic Surface Single interface * * Technology qq:4009633321 * @ Technology QQ Group: 200121393 * @see: http://www.kdniao.com/MiandanAPI.aspx * @copyright: Shenzhen City Express Gold Data Technology Service CO., LTD. * * * ID and key Please apply to the official website: http://www.kdniao.com/ServiceApply.aspx */public class Kdgoldapidemo {//E-commerce idprivate String ebusinessid= "Please apply to express Bird official website http://www.kdniao.com/ServiceApply.aspx";//e-commerce encryption private key, courier Bird provided, pay attention to safekeeping, do not leak private String Appkey= "Please go to express Bird official website to apply for http://www.kdniao.com/ServiceApply.aspx";//Request URL, formal environment address: http://api.kdniao.cc/api/ Eorderserviceprivate String requrl= "Http://testapi.kdniao.cc:8081/api/Eorderservice";/** * JSON mode e-form * @throws EXCEP tion */public String orderonlineByjson () throws Exception{string requestdata= "{' Ordercode ': ' 012657700387 '," + "' shippercode ': ' EMS '," + "' PayType ': 1," + "' exptype ': 1," + "' Cost ': 1.0," + "' othercost ': 1 .0, "+" ' Sender ': "+" {"+" ' Company ': ' LV ', ' Name ': ' Taylor ', ' Mobile ': ' 15018442                396 ', ' provincename ': ' Shanghai ', ' cityname ': ' Shanghai ', ' expareaname ': ' Qingpu ', ' Address ': ' Pearl Road 73rd ', ' + ' ' Receiver ': ' + "{" + "' Company ': ' Gccui ', ' Name ': ' Yann ', ' Mobile ': ' 15018442396 ', ' provincename ': ' Beijing ', ' cityname ': ' Beijing ', ' Expareaname ': ' Chaoyang District ', ' Address ': ' Three Sanlitun street Yashow Building '}, ' + ' ' commodity ': ' + ' [{' + ' ' good                SName ': ' Shoes ', ' goodsquantity ': 1, ' Goodsweight ': 1.0}], ' + ' ' Weight ': 1.0, ' + ' ' Quantity ': 1, ' + "' Volume ': 0.0," + "' Remark ': ' Handle with care ', ' + ' ' isreturnprinttemplate ': 1}"; map<string, string> params =New hashmap<string, string> ();p arams.put ("RequestData", Urlencoder (RequestData, "UTF-8"));p Arams.put (" Ebusinessid ", Ebusinessid);p arams.put (" RequestType "," 1007 "); String Datasign=encrypt (RequestData, AppKey, "UTF-8");p arams.put ("Datasign", Urlencoder (Datasign, "UTF-8")); Params.put ("DataType", "2"); String result=sendpost (Requrl, params);//The information returned according to the company's business process ... return result; /** * MD5 encryption * @param STR content * @param charset encoding method * @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 <= 0xf) {sb.append ("0");    } sb.append (Integer.tohexstring (Val)); } return Sb.tostring (). toLowerCase ();} /** * Base64 Code * @param STR content * @param charset encoding method * @throws unsupportedencodingexception */private string base64 (string STR, String CharSet) throws unsupportedencodingexception{string encoded = Base64.encode (Str.getbytes (CharSet)); return    encoded; } @SuppressWarnings ("unused") Private String Urlencoder (String str, String charset) throws Unsupportedencodingexception {String result = Urlencoder.encode (str, charset); return result;} /** * e-commerce sign Signature generation * @param content Contents * @param keyValue Appkey * @param charset encoding method * @throws Unsuppo Rtedencodingexception, Exception * @return datasign Signature */@SuppressWarnings ("unused") private string Encrypt (String cont ENT, String keyValue, String charset) throws Unsupportedencodingexception, Exception{if (keyValue! = null) {return Base64 ( MD5 (content + KeyValue, CharSet), CharSet);} Return base64 (MD5 (Content, CharSet), CharSet);} /** * Request to send a POST method to the specified URL * @param URL to send the request * @param parameter collection of params request * @retUrn Remote resource response result */@SuppressWarnings ("unused") Private String sendpost (string url, map<string, string> params) {        OutputStreamWriter out = null;                BufferedReader in = null;         StringBuilder result = new StringBuilder ();            try {URL realurl = new URL (URL);            HttpURLConnection conn = (httpurlconnection) realurl.openconnection ();            The Send POST request must be set to the following two lines conn.setdooutput (true);            Conn.setdoinput (TRUE);            Post Method Conn.setrequestmethod ("post");            Set the generic request attribute Conn.setrequestproperty ("accept", "*/*");            Conn.setrequestproperty ("Connection", "keep-alive"); Conn.setrequestproperty ("User-agent", "mozilla/4.0" (compatible; MSIE 6.0; Windows NT 5.1;            SV1) ");            Conn.setrequestproperty ("Content-type", "application/x-www-form-urlencoded");            Conn.connect (); Gets the output stream corresponding to the URLConnection object out = new OutputstreaMwriter (Conn.getoutputstream (), "UTF-8");           Send request parameter if (params! = null) {StringBuilder param = new StringBuilder (); For (map.entry<string, string> entry:params.entrySet ()) {if (Param.length () >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 output stream buffer Out.flush (); Defines the BufferedReader input stream to read the response of the URL in = new BufferedReader (New InputStreamReader (conn.getinput            Stream (), "UTF-8"));            String Line;            while (line = In.readline ())! = null) {result.append (line);                }} catch (Exception e) {        E.printstacktrace (); }//Use finally block to close the output stream, input stream finally{try{if (out!=null) {Out.close                ();                } if (In!=null) {in.close ();            }} catch (IOException ex) {ex.printstacktrace ();    }} return result.tostring (); }}



E-commerce ERP How to access the Express bird electronic surface single API?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.