共计 5748 个字符,预计需要花费 15 分钟才能阅读完成。
电子面单 API 产品介绍
电子面单服务提供了获取物流单号、打印电子面单的性能,满足企业的疾速打单、回传物流单号的需要。一步对接淘宝 / 菜鸟 / 拼多多 / 京东等电商平台的电子面单
1. 电子面单打印接口
本接口反对打印电子面单,反对 30+ 快递公司面单打印。商家需向当地快递公司的网点申请电子面单账号 / 月结账号,或者通过淘宝 / 菜鸟 / 拼多多 / 京东第三方受权应用月结账号。
本接口须要应用快递 100 的打印设施进行打印。若商家没有打印机,能够应用快递 100 的云打印机进行打印,若商家曾经有打印机,须要连贯快递 100 云盒进行打印。
本接口反对快递公司面单模板的抉择及自定义批改,反对近程打印及多人多部门打印。
2. 电子面单图片接口
本接口反对生成电子面单图片。商家需向当地快递公司的网点申请电子面单账号 / 月结账号,或者通过淘宝 / 菜鸟 / 拼多多 / 京东第三方受权应用月结账号。生成图片后,商家能够通过本地打印机进行打印。
本接口反对快递公司面单模板的抉择及自定义批改。
3. 电子面单 HTML 接口
本接口反对生成电子面单的 HTML 页面。商家需向当地快递公司的网点申请电子面单账号 / 月结账号,或者淘宝 / 菜鸟 / 拼多多 / 京东第三方受权应用月结账号。该页面展现面单的模板不能抉择,是面单的固定模板。商家能够通过本地打印机打印生成页面。
4. 反对的快递公司列表
电子面单 API 反对 30+ 家快递公司网点面单打印、支流电商平台(淘宝、京东、拼多多)面单打印以及国内快递公司面单打印。具体列表清查看参数字典
/**
* 电子面单图片接口
*/
@Test
public void testPrintImg() throws Exception{PrintImgParam printImgParam = new PrintImgParam();
printImgParam.setKuaidicom(CompanyConstant.ZJS);
printImgParam.setSendManName("张三");
printImgParam.setSendManMobile("15999566666");
printImgParam.setSendManPrintAddr("广东省深圳市南山区科技南十二路");
printImgParam.setRecManName("李四");
printImgParam.setRecManMobile("15999566666");
printImgParam.setRecManPrintAddr("北京市海淀区 xxx 路");
printImgParam.setType("10");
printImgParam.setTempid("180c7c8f646742ca871a92c976392b05");
printImgParam.setCount("1");
String param = new Gson().toJson(printImgParam);
String t = System.currentTimeMillis() + "";
String sign = SignUtils.printSign(param,t,key,secret);
PrintReq printReq = new PrintReq();
printReq.setKey(key);
printReq.setMethod(ApiInfoConstant.ELECTRONIC_ORDER_PIC_METHOD);
printReq.setSign(sign);
printReq.setParam(param);
printReq.setT(t);
IBaseClient printImg = new PrintImg();
System.out.println(printImg.execute(printReq));
}
/**
* 电子面单 html 接口
*/
@Test
public void testPrintHtml() throws Exception{ManInfo recManInfo = new ManInfo();
recManInfo.setName("张三");
recManInfo.setMobile("15999566666");
recManInfo.setPrintAddr("广东省深圳市南山区科技南十二路");
ManInfo sendManInfo = new ManInfo();
sendManInfo.setName("李四");
sendManInfo.setMobile("15999566666");
sendManInfo.setPrintAddr("北京市海淀区 xxx 路");
PrintHtmlParam printHtmlParam = new PrintHtmlParam();
printHtmlParam.setKuaidicom(CompanyConstant.ZJS);
printHtmlParam.setCount(2);
printHtmlParam.setNeedChild(1);
// 如果须要返回电子面单,须要设置
printHtmlParam.setNeedTemplate("1");
printHtmlParam.setSendMan(sendManInfo);
printHtmlParam.setRecMan(recManInfo);
String t = System.currentTimeMillis() + "";
String param = new Gson().toJson(printHtmlParam);
String sign = SignUtils.printSign(param,t,key,secret);
PrintReq printReq = new PrintReq();
printReq.setKey(key);
printReq.setMethod(ApiInfoConstant.ELECTRONIC_ORDER_HTML_METHOD);
printReq.setT(t);
printReq.setSign(sign);
printReq.setParam(param);
IBaseClient printHtml = new PrintHtml();
System.out.println(printHtml.execute(printReq));
}
/**
* 电子面单打印
*/
@Test
public void testPrintCloud() throws Exception{ManInfo recManInfo = new ManInfo();
recManInfo.setName("张三");
recManInfo.setMobile("15999566666");
recManInfo.setPrintAddr("广东省深圳市南山区科技南十二路");
ManInfo sendManInfo = new ManInfo();
sendManInfo.setName("李四");
sendManInfo.setMobile("15999566666");
sendManInfo.setPrintAddr("北京市海淀区 xxx 路");
PrintCloudParam printCloudParam = new PrintCloudParam();
printCloudParam.setKuaidicom(CompanyConstant.ZJS);
printCloudParam.setCount("1");
printCloudParam.setSiid(siid);
printCloudParam.setTempid("180c7c8f646742ca871a92c976392b05");
printCloudParam.setSendMan(sendManInfo);
printCloudParam.setRecMan(recManInfo);
String param = new Gson().toJson(printCloudParam);
String t = System.currentTimeMillis() + "";
PrintReq printReq = new PrintReq();
printReq.setT(t);
printReq.setKey(key);
printReq.setMethod(ApiInfoConstant.ELECTRONIC_ORDER_PRINT_METHOD);
printReq.setSign(SignUtils.printSign(param,t,key,secret));
printReq.setParam(param);
IBaseClient baseClient = new PrintCloud();
System.out.println(baseClient.execute(printReq));
}
/**
* 云打印自定义
*/
@Test
public void testCloudCustom() throws Exception{CloudPrintCustomParam cloudPrintCustomParam = new CloudPrintCustomParam();
cloudPrintCustomParam.setSiid(siid);
cloudPrintCustomParam.setCallBackUrl("http://www.baidu.com");
cloudPrintCustomParam.setTempid("180c7c8f646742ca871a92c976392b05");
String t = System.currentTimeMillis() + "";
String param = new Gson().toJson(cloudPrintCustomParam);
PrintReq printReq = new PrintReq();
printReq.setKey(key);
printReq.setMethod(ApiInfoConstant.CLOUD_PRINT_CUSTOM_METHOD);
printReq.setT(t);
printReq.setSign(SignUtils.printSign(param,t,key,secret));
printReq.setParam(param);
IBaseClient baseClient = new CloudPrintCustom();
System.out.println(baseClient.execute(printReq));
}
/**
* 云打印附件
*/
@Test
public void testCloudAttachment() throws Exception{CloudPrintAttachmentParam cloudPrintAttachmentParam = new CloudPrintAttachmentParam();
cloudPrintAttachmentParam.setSiid(siid);
cloudPrintAttachmentParam.setCallBackUrl("http://www.baidu.com");
String t = System.currentTimeMillis() + "";
String param = new Gson().toJson(cloudPrintAttachmentParam);
CloudAttachmentReq cloudPrintAttachmentReq = new CloudAttachmentReq();
cloudPrintAttachmentReq.setKey(key);
cloudPrintAttachmentReq.setMethod(ApiInfoConstant.CLOUD_PRINT_ATTACHMENT_METHOD);
cloudPrintAttachmentReq.setT(t);
cloudPrintAttachmentReq.setSign(SignUtils.printSign(param,t,key,secret));
cloudPrintAttachmentReq.setParam(param);
cloudPrintAttachmentReq.setFile(new File("C:\\Users\\Administrator.-20171106WFEKLN\\Desktop\\1.jpg"));
IBaseClient baseClient = new CloudPrintAttachment();
System.out.println(baseClient.execute(cloudPrintAttachmentReq));
}
/**
* 复打
*/
@Test
public void testCloudPrintOld() throws Exception{PrintReq printReq = new PrintReq();
CloudPrintOldParam cloudPrintOldParam = new CloudPrintOldParam();
cloudPrintOldParam.setTaskId("D21DB1AC74A260E6F5604FC43B4598B8");
String t = System.currentTimeMillis() + "";
String param = new Gson().toJson(cloudPrintOldParam);
printReq.setKey(key);
printReq.setMethod(ApiInfoConstant.CLOUD_PRINT_OLD_METHOD);
printReq.setT(t);
printReq.setSign(SignUtils.printSign(param,t,key,secret));
printReq.setParam(param);
IBaseClient cloudPrintOld = new CloudPrintOld();
System.out.println(cloudPrintOld.execute(printReq));
}
官网文档接口
参数字典
正文完