A variety of electronic surface single-api interface (Shun Fung, express birds, rookie) _ Electronic surface list

Source: Internet
Author: User
Tags base64 finally block md5 md5 encryption unique id stringbuffer

Terminology electronic surface single style docking interface comparison of the different cooperation process interface definitions and instructions Request Params system-level parameters Common parameter interface parameters Response Params java chestnuts similar articles


For ordinary people, the meaning of electronic surface list may not be very understanding, plainly, is the courier to you print the electronic version of the Express.

Professional explanation:

The electronic surface is a kind of logistics service which can print out the paper logistics surface form through the heat sensitive paper. Through the thermal induction display text, printing speed than the traditional needle printing speed 4~6 times. Electronic surface is embedded in the form of the interface to their own systems, Web sites, you can operate on their own platform to print electronic sheet. Electronic surface single Style

Docking interface In contrast to express electronic surface single interface: Express Company's own development of electronic surface single service, business use must express the company door-to-door system docking, use a courier will need docking once. Rookie electronic Surface single interface: can be a docking 15 Express company, without and every express company do docking. Support Express has four Qualcomm, EMS, home urgent delivery, Darbond, excellent speed, daily, fast, Pang and other 15 commonly used courier companies, including Shun Fung. Express Bird Electronic Surface Single interface: can be a docking 15 Express company, without and every express company do docking. Support Express has four Qualcomm, Shun Fung, EMS, home urgent delivery, Darbond, excellent speed, such as 15 Express company, to shun Fung has electronic surface single service demand can choose Shun Fung own electronic surface single or express bird electronic surface list. Comparison of cooperation processes between different families

Express Electronic Surface Single interface
A. And a number of courier companies to apply for account
B. Interface docking respectively
C. e-Face single service users to The Courier Network application and confirm the details of cooperation

Rookie electronic face sheet
A. Submit a docking application to the rookie network
B. Interface docking with rookie
C. Electronic Surface list service users to the rookie application account
D. e-Face single service users to The Courier Network application and confirm the details of cooperation

Express Bird Electronic Surface list
A. Access to the application account, obtain the exclusive ID and key
B. Interface docking with express birds
C. Electronic Surface single service users to The Courier Network application and confirm the details of cooperation; Of course, shun Fung Electronic surface single slightly special point, namely: Shun Fung access to express birds can immediately use, no registration account. Interface Definition and description

Because, the current express bird support electronic Surface single interface relative to other home has a certain advantage; So the following mainly to express the birds as an example to carry out the elaboration of the one by one description. Request Params

API Interface: http://api.kdniao.cc/Ebusiness/EbusinessOrderHandle.aspx
Request Method: POST
Encoding: UTF-8 system-level parameter (public parameter) parameter name type description is required RequestData String request content requires a URL (utf-8) encoding. Request content JSON format, and datatype consistent R EBUSINESSID string merchant ID, view r requesttype string request instruction type on my Services page: 1007 r datasign String data content signature: put (please Ask for content (not encoded) +appkey) for MD5 encryption, then BASE64 encoding, and finally URL (utf-8) encoding. For detailed procedures, see demo R DataType String request, return data type: Only JSON format is supported O

Note: R-Must-fill (Required), O-Optional (Optional), C-the parameter is optional under certain conditions (Conditional) in the message. Interface parameter parameter name type description is required CallBack String user custom callback information o MemberID string member id o CustomerName string electronic face single customer account (with express dot application) o CUSTOMERPW D string Electronic surface single password o sendsite string collection dot identification o shippercode string Express Company code r logisticcode String Express number O Ordercode string order ID r Monthcode string C paytype Int postage Payment: 1-pay-as-you-go, 2-to-pay, 3-month knot, 4-third party payment R Exptype String Express type: 1-standard Express R cost Double shipping fee (freight) O Oth Ercost Double Other fee o StartDate string Pick-up time period: "Yyyy-mm-dd HH:mm:ss" format, all the time formats in this article are the same O enddate String door-to-door pickup time: "Yyyy-mm-dd HH : MM:SS "format, all the time formats in this article are identical o Weight double items total weight kg o Quantity Int/parcel o Volume Double items total volume M3 O remark String remark o Isreturn Printtemplate String returns the electronic surface template: 0-not required; 1-Requires O Receiver company String Recipient Corporation O Name String recipient R Tel String phone and cell phone, must fill in an R Mobil e String telephone and cell phone, must fill in an R postcode string recipient Zip O Provincename String Collection province (such as Guangdong province, do not lack the "province") R CityName String Collection city (such as Shenzhen, do not lack of "city") r Expareaname string receipts area (such as Futian District, do not lack "district" or "County") O address string recipient details R Sender Company String Sender company O Name String Recipient R Tel string phone and cell phone, must fill in an R mobile string phone and cell phone, must fill in an R postcode string sender Zip O provincename String Sender province (such as Guangdong province, do not lack "province") r CityName string Sender city (such as Shenzhen, do not lack the "city") r Expareaname string outbox (such as Futian District, do not lack "district" or "County") O address String hair Person Detail Address R addservices AddService name string value-added service name O value String Value Added service value o CustomerID string customer identification (optional) o commoditys commodit Y goodsname String commodity name R Goodscode string Commodity code o goodsquantity string Commodity quantity o Goodsprice string commodity price o Goodsweight string Product weight kg o goodsdesc string Product description o Goodsvol string commodity volume M3 o Response Params parameter name type description Required EBUSINESSID String User ID R succes s Bool success or not r ResultCode string error encoding R Reason string failure reason O Uniquerrequestnumber string unique ID r printtemplate String surface print Template o estimateddeliverytime string Order estimated arrival time Yyyy-mm-dd o Callback String User custom callback information o order ordercode String orders number R Shippercode String Express Company code r logisticcode String Express number R markdestination string large head pen o Origincode string originating region code O Originname string Origin /Originating Outlets O Destinatiocode STring Destination Area code o destinationame string destination/Arrival dot o sortingcode string sorting code o packagecode string Set packet code o java chestnuts

Note: This chestnut is for reference only, if you want to use the official download the corresponding language demo can.

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 * @copyri Ght: Shenzhen Fast Gold Data Technology Service CO., LTD. * * ID and key please go to the official website application: http://www.kdniao.com/ServiceApply.aspx/public class Kdgoldapidemo {//    
    Electric Dealer ID Private String ebusinessid= "Please go to express Bird website application http://www.kdniao.com/ServiceApply.aspx";    
    Electronic Business encryption private key, express bird provide, pay attention to custody, do not leak private String appkey= "Please go to express Bird website application http://www.kdniao.com/ServiceApply.aspx"; Request URL, official environment address: Http://api.kdniao.cc/api/Eorderservice private String requrl= "http://testapi.kdniao.cc:8081/api/    

    Eorderservice ";/** * JSON mode electronic surface single * @throws Exception/public String Orderonlinebyjson () throws exception{S Tring requestdata= "{' Ordercode ': ' 012657700387 '," + "' shippercode ': ' EMS '," + "' PayType ': 1
                , "+" ' exptype ': 1, "+" ' Cost ': 1.0, "+" ' othercost ': 1.0, "+ "' Sender ':" + "{" + "' Company ': ' LV ', ' Name ': ' Taylor ', ' Mobile ': ' 15018442396 ', ' provincename '
                : ' Shanghai ', ' cityname ': ' Shanghai ', ' expareaname ': ' Qingpu ', ' Address ': ' Pearl Road No. 73rd '}, "+" ' Receiver ': "+" {"+ "' Company ': ' Gccui ', ' Name ': ' Yann ', ' Mobile ': ' 15018442396 ', ' provincename ': ' Beijing ', ' cityname ': ' Beijing ', ' expareaname ': ' Towards Yang qu ', ' address ': ' Three Li Tun Street Yaxiu Mansion '}, "+" ' commodity ': "+" [{+] ' goodsname ': ' 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> ();
        Params.put ("RequestData", Urlencoder (RequestData, "UTF-8"));
        Params.put ("Ebusinessid", Ebusinessid);
        Params.put ("RequestType", "1007");
        String Datasign=encrypt (RequestData, Appkey, "UTF-8");
        Params.put ("Datasign", Urlencoder (Datasign, "UTF-8"));

        Params.put ("DataType", "2");    

        String result=sendpost (Requrl, params);
    Information returned according to the company's business process ... return result; /** * MD5 encryption * @param STR content * @param charset encoding * @throws Exception/@Suppr Esswarnings ("unused") Private String MD5 (String str, String charset) throws Exception {MessageDigest MD = Mes
        Sagedigest.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 * @throws unsupportedencodingexcept Ion */private string base64 (String str, String charset) throws unsupportedencodingexception{string enc
        Oded = Base64.encode (Str.getbytes (charset));    
    return encoded; @SuppressWarnings ("unused") Private String Urlencoder (String str, String charset) throws Unsupportedencodin
        gexception{String result = Urlencoder.encode (str, CharSet);
    return result;  /** * Electrical Quotient sign Signature generation * @param content * @param keyvalue Appkey * @param charset encoding * @throws unsupportedencodingexception, Exception * @rEturn datasign Signature */@SuppressWarnings ("unused") private string Encrypt (string content, String keyvalue, Stri Ng CharSet) throws Unsupportedencodingexception, Exception {if (keyvalue!= null) {retur
        N Base64 (MD5 (content + KeyValue, CharSet), CharSet);
    Return base64 (MD5 (Content, CharSet), CharSet); /** * Request to send the Post method to the specified URL * @param URL sends the requested URL * @param params requested parameter collection * @retu The response result of the RN remote resource * * @SuppressWarnings ("unused") private string sendpost (string url, map<string, string> par
        AMS) {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");
            Sets the common 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 = 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 () &G
                      t;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 response of the BufferedReader input stream to read the URL in = new BufferedReader (New InputStreamReader CONN.GETINP
            Utstream (), "UTF-8"));
            String Line;
            while (line = In.readline ())!= null) {result.append (line);
        } catch (Exception e) {e.printstacktrace (); ///Use finally block to turn off output stream, input stream finally{try{if (out!=null) {out.
                Close ();
                } if (In!=null) {in.close (); catch (IoexceptioN ex) {ex.printstacktrace ();
    } return result.tostring (); }

Other API interfaces, please go to the Express bird to view the relevant documents. Similar articles

All kinds of Express Query API interface (express bird)

Ps:coolspan Kdniao

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.