EMS快递查询
调用快递鸟提供的快递查询API标准接口,快速对接100多家快递公司的物流轨迹查询,本篇文章实现
首先我们准备好需要用到的资源,
这里推荐大家去爱奇艺查看视频教程:
https://www.iqiyi.com/v_19rxcwtwk0.html(如何从注册到认证,最快1小时完成上百家物流轨迹查询)
测试商户ID:
test1617571
测试API key:
554343b2-7252-439b-b4eb-1af42c8f2175(此Key仅限测试环境使用)
API测试地址:
http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json
接口参数,也叫业务参数,请求的业务接口不同,参数的字段,内容也不同,是跟着业务变化的,这里我们实现的是即时查询接口,请求指令类型:1002,快递鸟官网要求必须传递快递公司编码和物流单号 ,EMS快递的编码是EMS
如要查看其他快递公司的编码,点击此链接:
http://www.kdniao.com/documents
我们用真实单号(1160001630231)来完成轨迹接口调用,
请求 JSON
{'OrderCode':'','ShipperCode':'EMS','LogisticCode':' 1160001630231'}
请求的完整报文(URL编码以后):
RequestData=%7b%27OrderCode%27%3a%27%27%2c%27ShipperCode%27%3a%27EMS%27%2c%27LogisticCode%27%3a%271160001630231%27%7d%0d%0a++++++++&EBusinessID=1264783&RequestType=1002&DataSign=NDlmMDAzZTYwYmYyY2FmZjRjOTNhZDAwYjVkNDVjODM%3d&DataType=2
未编码的请求报文:
RequestData={'OrderCode':'','ShipperCode':'EMS','LogisticCode':'1160001630231'} &EBusinessID=1264783&RequestType=1002&DataSign=NDlmMDAzZTYwYmYyY2FmZjRjOTNhZDAwYjVkNDVjODM=&DataType=2
返回参数定义:
返回报文信息
{
"LogisticCode": "1160001630231",
"ShipperCode": "EMS",
"Traces": [{
"AcceptStation": "[莆田市]【莆田电商营业部】已收件,揽投员:郑美停,电话:15260903325",
"AcceptTime": "2020-02-06 20:12:56"
}, {
"AcceptStation": "[莆田市]离开【莆田电商营业部】,下一站【莆田市邮区中心】",
"AcceptTime": "2020-02-06 20:15:50"
}, {
"AcceptStation": "[莆田市]到达【莆田市邮区中心】",
"AcceptTime": "2020-02-06 20:17:26"
}, {
"AcceptStation": "[莆田市]离开【莆田市邮区中心】,下一站【福州旗山处理中心】",
"AcceptTime": "2020-02-06 23:59:31"
}, {
"AcceptStation": "[福州市]到达【福州旗山处理中心】(经转)",
"AcceptTime": "2020-02-07 17:40:37"
}, {
"AcceptStation": "[福州市]离开【福州旗山处理中心】,下一站【长沙邮件处理中心】(经转)",
"AcceptTime": "2020-02-08 04:56:41"
}, {
"AcceptStation": "[长沙市]到达【长沙邮件处理中心】(经转)",
"AcceptTime": "2020-02-08 16:05:58"
}, {
"AcceptStation": "[长沙市]离开【长沙邮件处理中心】,下一站【益阳邮件处理中心】(经转)",
"AcceptTime": "2020-02-08 20:28:47"
}, {
"AcceptStation": "[益阳市]到达【益阳邮件处理中心】",
"AcceptTime": "2020-02-09 00:25:22"
}, {
"AcceptStation": "[益阳市]离开【益阳邮件处理中心】,下一站【益阳市资阳揽投部】",
"AcceptTime": "2020-02-09 06:22:33"
}, {
"AcceptStation": "[益阳市]到达【益阳市资阳揽投部】",
"AcceptTime": "2020-02-09 08:56:06"
}, {
"AcceptStation": "[益阳市]【益阳市资阳揽投部】安排投递,投递员:龙飞跃,电话:15898401808,揽投部电话:17773770736",
"AcceptTime": "2020-02-09 09:26:09"
}, {
"AcceptStation": "[益阳市]已签收,收发室,投递员:龙飞跃,电话:15898401808",
"AcceptTime": "2020-02-09 15:03:48"
}],
"State": "3",
"EBusinessID": "1264783",
"Success": true
}
这里根据我们的实际业务需求来选择免费套餐或者收费套餐。
附上详细的接口文档给大家:
http://www.kdniao.com/documents