您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 销售管理 > 电子面单接口平台使用说明
电子面单接口平台使用说明1)电子面单格式2)接口说明a.电子面单接口是提供给独立电商、仓储管理系统、物流供应链等物流系统平台使用的下单接口。b.为客户解决在线发货需求,商户通过网络选择快递公司发送请求通知快递公司有快递要发货。c.客户把数据通过此接口转发,由接口安排快递员上门取件的服务。d.订单编号(OrderCode)不可重复提交,重复提交系统会返回具体错误代码。e.360.com接口支持的消息接收方式为HTTPPOST,请求方法的编码格式(utf-8):application/x-=utf-8。f.接口地址:API测试地址:正式地址:接口提供:快递鸟3)JSON格式请求{OrderCode:560031072312,ShipperCode:YTO,PayType:1,ExpType:1,Cost:1.0,OtherCost:1.0,Sender:{Company:LV,Name:Taylor,Mobile:15018442396,ProvinceName:上海,CityName:上海,ExpAreaName:青浦区,Address:明珠路73号},Receiver:{Company:GCCUI,Name:Yann,Mobile:15018442396,ProvinceName:北京,CityName:北京,ExpAreaName:朝阳区,Address:三里屯街道雅秀大厦},Commodity:[{GoodsName:鞋子,Goodsquantity:1,GoodsWeight:1.0}],AddService:[{Name:COD,Value:1020}],Weight:1.0,Quantity:1,Volume:0.0,Remark:小心轻放,IsReturnPrintTemplate:14)JSON格式返回-失败{EBusinessID:1237100,ResultCode:105,Reason:订单号已存在,请勿重复操作,UniquerRequestNumber:5e66486b-8fbc-4131-b875-9b13d2ad1354}5)JSON格式返回-成功{EBusinessID:1237100,Order:{OrderCode:560031072312,ShipperCode:YTO,LogisticCode:50002498503427,MarkDestination:京-朝阳(京-1),OriginCode:200000,OriginName:上海分拨中心,PackageCode:北京},PrintTemplate:此处省略打印模板HTML内容,EstimatedDeliveryTime:2016-03-06,Callback:调用时传入的Callback,Success:true,ResultCode:100,Reason:成功}6)JAVA对接源码importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStreamWriter;importjava.io.UnsupportedEncodingException;importjava.net.HttpURLConnection;importjava.net.URL;importjava.net.URLEncoder;importjava.util.HashMap;importjava.util.Map;importcom.sun.org.apache.xerces.internal.impl.dv.util.Base64;importjava.security.MessageDigest;publicclassKdGoldAPIDemo{//电商IDprivateStringEBusinessID=请申请电商加密私钥,注意保管,不要泄漏privateStringAppKey=请申请请求url,正式环境地址:=***Json方式电子面单*@throwsException*/publicStringorderOnlineByJson()throwsException{StringrequestData={'OrderCode':'012657700387',+'ShipperCode':'EMS',+'PayType':1,+'ExpType':1,+'Cost':1.0,+'OtherCost':1.0,+'Sender':+{+'Company':'LV','Name':'Taylor','Mobile':'15018442396','ProvinceName':'上海','CityName':'上海','ExpAreaName':'青浦区','Address':'明珠路73号'},+'Receiver':+{+'Company':'GCCUI','Name':'Yann','Mobile':'15018442396','ProvinceName':'北京','CityName':'北京','ExpAreaName':'朝阳区','Address':'三里屯街道雅秀大厦'},+'Commodity':+[{+'GoodsName':'鞋子','Goodsquantity':1,'GoodsWeight':1.0}],+'Weight':1.0,+'Quantity':1,+'Volume':0.0,+'Remark':'小心轻放',+'IsReturnPrintTemplate':1};MapString,Stringparams=newHashMapString,String();params.put(RequestData,urlEncoder(requestData,UTF-8));params.put(EBusinessID,EBusinessID);params.put(RequestType,1007);StringdataSign=encrypt(requestData,AppKey,UTF-8);params.put(DataSign,urlEncoder(dataSign,UTF-8));params.put(DataType,2);Stringresult=sendPost(ReqURL,params);//根据公司业务处理返回的信息......returnresult;}/***MD5加密*@paramstr内容*@paramcharset编码方式*@throwsException*/@SuppressWarnings(unused)privateStringMD5(Stringstr,Stringcharset)throwsException{MessageDigestmd=MessageDigest.getInstance(MD5);md.update(str.getBytes(charset));byte[]result=md.digest();StringBuffersb=newStringBuffer(32);for(inti=0;iresult.length;i++){intval=result[i]&0xff;if(val=0xf){sb.append(0);}sb.append(Integer.toHexString(val));}returnsb.toString().toLowerCase();}/***base64编码*@paramstr内容*@paramcharset编码方式*@throwsUnsupportedEncodingException*/privateStringbase64(Stringstr,Stringcharset)throwsUnsupportedEncodingException{Stringencoded=Base64.encode(str.getBytes(charset));returnencoded;}@SuppressWarnings(unused)privateStringurlEncoder(Stringstr,Stringcharset)throwsUnsupportedEncodingException{Stringresult=URLEncoder.encode(str,charset);returnresult;}/***电商Sign签名生成*@paramcontent内容*@paramkeyValueAppkey*@paramcharset编码方式*@throwsUnsupportedEncodingException,Exception*@returnDataSign签名*/@SuppressWarnings(unused)privateStringencrypt(Stringcontent,StringkeyValue,Stringcharset)throwsUnsupportedEncodingException,Exception{if(keyValue!=null){returnbase64(MD5(content+keyValue,charset),charset);}returnbase64(MD5(content,charset),charset);}/***向指定URL发送POST方法的请求*@paramurl发送请求的URL*@paramparams请求的参数集合*@return远程资源的响应结果*/@SuppressWarnings(unused)privateStringsendPost(Stringurl,MapString,Stringparams){OutputStreamWriterout=null;BufferedReaderin=null;StringBuilderresult=newStringBuilder();try{URLrealUrl=newURL(url);HttpURLConnectionconn=(HttpURLConnection)realUrl.openConnection();//发送POST请求必须设置如下两行conn.setDoOutput(true);conn.setDoInput(true);//POST方法conn.setRequestMethod(POST);//设置通用的请求属性conn.setRequestProperty(accept,*/*);conn.setRequestProperty(connection,Keep-Alive);conn.setRequestProperty(user-agent,Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;SV1));conn.setRequestProperty(Content-Type,application/x-);conn.connect();//获取URLConnection对象对应的输出流out=newOutputStreamWriter(conn.getO
本文标题:电子面单接口平台使用说明
链接地址:https://www.777doc.com/doc-2211688 .html