简单的从快递 100 中获取快递信息

快递查询

经常有应用需求能根据单号查询快递状态,大多数时候都需求快递的运输信息。我们可以从 快递 100 中快速的获取到快递的物流信息。

接口分析

快递 100 中提供了两个接口用来结合查询物流信息:

  • 根据单号智能识别物流方式(顺丰、韵达、申通等)
  • 根据单号及物流方式获取物流信息

智能识别接口

接口地址: http://www.kuaidi100.com/autonumber/autoComNum?text=[单号]
请求方式: GET

接口返回:

成功返回:

1
2
3
4
5
6
7
8
9
10
11
12
13
{
   "comCode" : "" ,
   "num" : "3310479082803" ,
   "auto" : [
     {
     "comCode" : "shentong" ,
     "id" : "" ,
     "noCount" : 94165,
     "noPre" : "331047" ,
     "startTime" : ""
     }
   ]
}

如果是不能识别的单号那么将返回:

1
2
3
4
5
{
   "comCode" : "" ,
   "num" : "xxx51017908280" ,
   "auto" : []
}

物流详情接口

接口地址: http://www.kuaidi100.com/query?type=[comCode]&postid=[单号]&id=1&valicode=&temp=[时间戳]
请求方式: GET

接口返回信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
     "message" : "ok" ,
     "nu" : "3310479082803" ,
     "ischeck" : "0" ,
     "com" : "shentong" ,
     "updatetime" : "2016-07-27 13:15:45" ,
     "status" : "200" ,
     "condition" : "00" ,
     "data" : [
         {
             "time" : "2016-06-30 03:17:28" ,
             "location" : "" ,
             "context" : "快件已到达 湖北武汉武隆分部" ,
             "ftime" : "2016-06-30 03:17:28"
         },
         {
             "time" : "2016-06-29 16:35:02" ,
             "location" : "" ,
             "context" : "由 浙江杭州中转部 发往 安徽黄山公司" ,
             "ftime" : "2016-06-29 16:35:02"
         },
         {
             "time" : "2016-06-29 16:22:00" ,
             "location" : "" ,
             "context" : "由 湖北武汉航空部 发往 湖北武汉武隆分部" ,
             "ftime" : "2016-06-29 16:22:00"
         },
         {
             "time" : "2016-06-28 23:09:29" ,
             "location" : "" ,
             "context" : "由 湖北武汉航空部 发往 浙江杭州中转部" ,
             "ftime" : "2016-06-28 23:09:29"
         },
         {
             "time" : "2016-06-28 20:03:09" ,
             "location" : "" ,
             "context" : "由 湖北武汉航空部 发往 浙江杭州中转部" ,
             "ftime" : "2016-06-28 20:03:09"
         },
         {
             "time" : "2016-06-28 20:03:09" ,
             "location" : "" ,
             "context" : "湖北武汉航空部 正在进行 装袋 扫描" ,
             "ftime" : "2016-06-28 20:03:09"
         },
         {
             "time" : "2016-06-28 20:02:52" ,
             "location" : "" ,
             "context" : "由 湖北武汉航空部 发往 浙江杭州中转部" ,
             "ftime" : "2016-06-28 20:02:52"
         },
         {
             "time" : "2016-06-28 19:58:24" ,
             "location" : "" ,
             "context" : "快件已到达 湖北武汉航空部" ,
             "ftime" : "2016-06-28 19:58:24"
         },
         {
             "time" : "2016-06-28 17:12:28" ,
             "location" : "" ,
             "context" : "湖北武汉公司(027-83225888) 的收件员 汉口吴燕飞 已收件" ,
             "ftime" : "2016-06-28 17:12:28"
         }
     ],
     "state" : "0"
}

异常返回:

1
2
3
4
{
   "status" : "403" ,
   "message" : "快递公司参数异常:单号格式错误"
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值