顺丰,四通一达,京东,百世,天天,德邦快递目前提供了两种对接方式:

  1. 一种是开发者自助对接,需要注册账户后,申请成为开发者,再根据要求对接,整个流程较为繁琐;
  2. 还有一种方式就是通过第三方快递单号查询API接口服务商对接(例如快递100API)

如果对接公司数量超过3家,对接起来会比直接对接顺丰,四通一达,京东,百世,天天,德邦快递简单。

物流轨迹查询-使用的物流单号和快递单号即可实现查询物流信息。 对接在电商网站、SaaS系统或ERP系统上之后,使用者只需要输入快递单号就可以查询物流,不需要物流编码。整个流程是通过快递100API的两个接口实现的,一个是快递物流查询接口,一个是智能单号识别的接口,其中智能单号识别接口是免费使用的。

快递100API的java-demo 集成了实时查询、订阅推送、智能判断、云打印相关、电子面单相关、短信、商家寄件等接口。

此篇java-demo内容包括:物流轨迹接口+快递信息地图轨迹接口+快递状态更新订阅接口+智能识别接口方便开发者实现:运营前端下单寄件后自动回传物流单号且无需人工判断物流单号所属公司——>物流状态如有变化则自动更新到客户端和后台系统——>可视化展示物流运输路径或只展示文字信息。

语言:java

顺丰,四通一达,京东,百世,天天,德邦快递快递单号接口通过快递100API接口对接简单方便,顺丰,四通一达,京东,百世,天天,德邦快递快递查询接口API和电子面单接口可以通过快递100API对接,通过顺丰,四通一达,京东,百世,天天,德邦快递单号和手机号后四位查询轨迹信息,如果是通过快递100API下单获得的顺丰,四通一达,京东,百世,天天,德邦快递单号,可通过单号直接查询,具体查看快递100API接口技术文档查看接口说明。

物流轨迹接口demo:

Add Config

使用sdk的可以先配置account.properties,账号信息可以登录快递100获取https://poll.kuaidi100.com/manager/page/myinfo/enterprise (注意不要泄露快递100的账号密码以及授权key等敏感信息,以防被他人盗用!!!)

Gradle

  1. dependencies {
  2. implementation 'com.github.kuaidi100-api:sdk:1.0.4'
  3. }

Maven

  1. <dependency>
  2. <groupId>com.github.kuaidi100-api</groupId>
  3. <artifactId>sdk</artifactId>
  4. <version>1.0.4</version>
  5. </dependency>

Use Junit Test

  1. public class BaseServiceTest {
  2. private String key = PropertiesReader.get("key");
  3. private String customer = PropertiesReader.get("customer");
  4. private String secret = PropertiesReader.get("secret");
  5. private String siid = PropertiesReader.get("siid");
  6. private String userid = PropertiesReader.get("userid");
  7. private String tid = PropertiesReader.get("tid");
  8. private String secret_key = PropertiesReader.get("secret_key");
  9. private String secret_secret = PropertiesReader.get("secret_secret");

物流轨迹接口-java-demo

  1. /**
  2. * 物流轨迹接口
  3. */
  4. @Test
  5. public void testQueryTrack() throws Exception{
  6. QueryTrackReq queryTrackReq = new QueryTrackReq();
  7. QueryTrackParam queryTrackParam = new QueryTrackParam();
  8. queryTrackParam.setCom(CompanyConstant.YT);
  9. queryTrackParam.setNum("YT9383342193097");
  10. queryTrackParam.setPhone("17725390266");
  11. String param = new Gson().toJson(queryTrackParam);
  12. queryTrackReq.setParam(param);
  13. queryTrackReq.setCustomer(customer);
  14. queryTrackReq.setSign(SignUtils.querySign(param ,key,customer));
  15. IBaseClient baseClient = new QueryTrack();
  16. System.out.println(baseClient.execute(queryTrackReq));
  17. }
  18. /**
  19. * 快递信息地图轨迹接口
  20. */

快递信息地图轨迹接口-java-demo

  1. /**
  2. * 快递信息地图轨迹接口
  3. */
  4. @Test
  5. public void testQueryMapView() throws Exception{
  6. QueryTrackReq queryTrackReq = new QueryTrackReq();
  7. QueryTrackParam queryTrackParam = new QueryTrackParam();
  8. queryTrackParam.setCom(CompanyConstant.YD);
  9. queryTrackParam.setNum("4311159956248");
  10. queryTrackParam.setPhone("17725390266");
  11. queryTrackParam.setFrom("河北保定市");
  12. queryTrackParam.setTo("湖南岳阳市");
  13. queryTrackParam.setResultv2("2");
  14. String param = new Gson().toJson(queryTrackParam);
  15. queryTrackReq.setParam(param);
  16. queryTrackReq.setCustomer(customer);
  17. queryTrackReq.setSign(SignUtils.querySign(param ,key,customer));
  18. IBaseClient baseClient = new QueryTrackMap();
  19. HttpResult result = baseClient.execute(queryTrackReq);
  20. QueryTrackMapResp queryTrackMapResp = new Gson().fromJson(result.getBody(),QueryTrackMapResp.class);
  21. System.out.println(queryTrackMapResp);
  22. }

快递状态更新订阅接口-java-demo

  1. /**
  2. * 快递状态更新订阅接口
  3. */
  4. @Test
  5. public void testSubscribe() throws Exception{
  6. SubscribeParameters subscribeParameters = new SubscribeParameters();
  7. subscribeParameters.setCallbackurl("http://www.baidu.com");
  8. subscribeParameters.setPhone("17725390266");
  9. SubscribeParam subscribeParam = new SubscribeParam();
  10. subscribeParam.setParameters(subscribeParameters);
  11. subscribeParam.setCompany(CompanyConstant.ST);
  12. subscribeParam.setNumber("773039762404825");
  13. subscribeParam.setKey(key);
  14. SubscribeReq subscribeReq = new SubscribeReq();
  15. subscribeReq.setSchema(ApiInfoConstant.SUBSCRIBE_SCHEMA);
  16. subscribeReq.setParam(new Gson().toJson(subscribeParam));
  17. IBaseClient subscribe = new Subscribe();
  18. System.out.println(subscribe.execute(subscribeReq));
  19. }

智能识别接口-java-demo

  1. /**
  2. * 智能识别接口(正式用户可以使用)
  3. */
  4. @Test
  5. public void testAutoNum() throws Exception{
  6. AutoNumReq autoNumReq = new AutoNumReq();
  7. autoNumReq.setKey(key);
  8. autoNumReq.setNum("773039762404825");
  9. IBaseClient baseClient = new AutoNum();
  10. System.out.println(baseClient.execute(autoNumReq));
  11. }

官方技术支持:https://api.kuaidi100.com/document/5eb9f5b686b0df41883139f4.html

更多相关文章

  1. 一次性接入顺丰,京东,申通,圆通,中通,韵达,天天,百世,德邦快递接
  2. 国内外7款好用的快递物流查询API工具
  3. 技术人员如何评估物流信息API服务商合不合格?可从这5点因素切入
  4. gogs 实现webhook钩子(php接口形式)
  5. ThinkPHP5 微信接口对接公共类
  6. 怎么用java调用快递查询和识别接口?
  7. python怎么查询快递信息?快递查询接口大全系列
  8. PHP快递查询接口api和快递单号智能判断PHP代码
  9. 顺丰快递单号查询API接口代码及流程【快递100API接口】

随机推荐

  1. Android开发入门_环境搭建
  2. android中 MediaStore提取缩略图和原始图
  3. 安卓巴士Android开发神贴整理
  4. Android滑动手势侦测方法介绍
  5. Android:EditText学习总结
  6. Android 数据存储之文件存储小记
  7. Android UI设计——EditText控件
  8. android 快速入门之一 “Hello world”,以
  9. 3.EditText控件
  10. Android:BottomNavigationView设置noActio