文档详情

免费物流查询API接口(JAVA PHP C )demo.docx

发布:2018-05-13约1.47万字共13页下载文档
文本预览下载声明
免费物流查询API接口(JAVA+PHP+C#)demo?(1)电商网站用户打开“我的订单”时调用此API显示物流信息详情。(2)电商管理后台的物流系统,客服在对账前查询所有运单的签收状态,并追踪问题。(3)每日调用次数限制不超过3000次,如超过该限制,请对接订阅推送API。(4)返回的物流跟踪信息按照发生的时间升序排列。(5)接口提供:快递鸟(6)接口指令1002。(7)接口支持的消息接收方式为HTTP POST,请求方法的编码格式(utf-8):application/x-www-form-urlencoded;charset=utf-8。JAVA代码importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStreamWriter;importjava.io.UnsupportedEncodingException;.HttpURLConnection;.URL;.URLEncoder;importjava.security.MessageDigest;importjava.util.HashMap;importjava.util.Map; public class KdniaoTrackQueryAPI {//DEMOpublic static void main(String[] args) {KdniaoTrackQueryAPIapi = new KdniaoTrackQueryAPI();try {String result = api.getOrderTracesByJson(ANE, 210001633605);System.out.print(result);} catch (Exception e) {e.printStackTrace();}}//电商IDprivate String EBusinessID=请申请;private String AppKey=请申请;//请求urlprivate String ReqURL=http://api.kdniao.cc/Ebusiness/EbusinessOrderHandle.aspx;/** * Json方式查询订单物流轨迹 * @throws Exception */public String getOrderTracesByJson(String expCode, String expNo) throws Exception{String requestData= {OrderCode:,ShipperCode: + expCode + ,LogisticCode: + expNo + };MapString, String params = new HashMapString, String();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);//根据公司业务处理返回的信息......return result;}/** * XML方式查询订单物流轨迹 * @throws Exception */public String getOrderTracesByXml() throws Exception{String requestData= ?xml version=\1.0\ encoding=\utf-8\ ?+Content+OrderCode/OrderCode+ShipperCodeSF/ShipperCode+LogisticCode589707398027/LogisticCode+/Content;MapString, String params = new HashMapString, String();params.put(RequestData, urlEncoder(requestData, UTF-8));params.put(EBusinessID, EBusinessID);params.put(Reques
显示全部
相似文档