圆通快递电子面单接口对接说明(全)1.接口类型说明1)接口支持的消息接收方式:HTTPPOST2)请求方法的编码格式(utf-8):application/x-=utf-83)API地址:)接口提供:快递鸟5)快递编码:YTO2.请求系统级参数参数名称类型说明必须要求RequestDataString请求内容需进行URL(utf-8)编码。请求内容JSON格式,须和DataType一致。REBusinessIDString商户ID,请在我的服务页面查看。RRequestTypeString请求指令类型:1007RDataSignString数据内容签名:把(请求内容(未编码)+AppKey)进行MD5加密,然后Base64编码,最后进行URL(utf-8)编码。详细过程请查看Demo。RDataTypeString请求、返回数据类型:只支持JSON格式O备注:R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional)。3.接口参数1)请求内容字段定义参数名称类型说明是否必须CallBackString用户自定义回调信息OMemberIDString会员标识OCustomerNameString电子面单客户账号(与快递网点申请)OCustomerPwdString电子面单密码OSendSiteString收件网点标识OShipperCodeString快递公司编码RLogisticCodeString快递单号OOrderCodeString订单编号RMonthCodeString月结编码CPayTypeInt邮费支付方式:1-现付,2-到付,3-月结,4-第三方支付RExpTypeString快递类型:1-标准快件RIsNoticeInt是否通知快递员上门揽件:0-通知;1-不通知;不填则默认为0OCostDouble寄件费(运费)OOtherCostDouble其他费用OReceiverCompanyString收件人公司ONameString收件人RTelString电话与手机,必填一个RMobileStringPostCodeString收件人邮编OProvinceNameString收件省(如广东省,不要缺少“省”)RCityNameString收件市(如深圳市,不要缺少“市”)RExpAreaNameString收件区(如福田区,不要缺少“区”或“县”)OAddressString收件人详细地址RSenderCompanyString发件人公司ONameString发件人RTelString电话与手机,必填一个RMobileStringPostCodeString发件人邮编OProvinceNameString发件省(如广东省,不要缺少“省”)RCityNameString发件市(如深圳市,不要缺少“市”)RExpAreaNameString发件区(如福田区,不要缺少“区”或“县”)OAddressString发件人详细地址RStartDateString上门取货时间段:yyyy-MM-ddHH:mm:ss格式化,本文中所有时间格式相同OEndDateStringOWeightDouble物品总重量kgOQuantityInt件数/包裹数OVolumeDouble物品总体积m3ORemarkString备注OAddServicesAddServiceNameString增值服务名称OValueString增值服务值OCustomerIDString客户标识(选填)OCommoditysCommodityGoodsNameString商品名称RGoodsCodeString商品编码OGoodsquantityInt商品数量OGoodsPriceDouble商品价格OGoodsWeightDouble商品重量kgOGoodsDescString商品描述OGoodsVolDouble商品体积m3OIsReturnPrintTemplateString返回电子面单模板:0-不需要;1-需要O2)返回参数定义参数名称类型说明必须要求EBusinessIDString用户IDROrderOrderCodeString订单编号RShipperCodeString快递公司编码RLogisticCodeString快递单号RMarkDestinationString大头笔OOriginCodeString始发地区域编码OOriginNameString始发地/始发网点ODestinatioCodeString目的地区域编码ODestinatioNameString目的地/到达网点OSortingCodeString分拣编码OPackageCodeString集包编码OSuccessBool成功与否RResultCodeString错误编码RReasonString失败原因OUniquerRequestNumberString唯一标识RPrintTemplateString面单打印模板OEstimatedDeliveryTimeString订单预计到货时间yyyy-mm-ddOCallbackString用户自定义回调信息O4.示例1)JSON请求示例{OrderCode:012657700387,ShipperCode:HTKY,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:1}2)JSON返回示例失败:{EBusinessID:1237100,ResultCode:105,Reason:订单号已存在,请勿重复操作,UniquerRequestNumber:5e66486b-8fbc-4131-b875-9b13d2ad1354}成功:{EBusinessID:1237100,Order:{OrderCode:012657700387,ShipperCode:HTKY,LogisticCode:50002498503427,MarkDestination:京-朝阳(京-1),OriginCode:200000,OriginName:上海分拨中心,PackageCode:北京},PrintTemplate:此处省略打印模板HTML内容,EstimatedDeliveryTime:2016-03-06,Callback:调用时传入的Callback,Success:true,ResultCode:100,Reason:成功}5.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;/****ID和Key请到官网申请:*/publicclassKdGoldAPIDemo{//电商IDprivateStringEBusinessID=ID请申请;//电商加密私钥,注意保管,不要泄漏privateStringAppKey=KEY请申请;//请求url,正式环境地址:=***Json方式电子面单*@throwsException*/publicStringorderOnlineByJson()throwsException{StringrequestData={'OrderCode':'118060839871',+'ShipperCode':'HHTT',+'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)throw