码迷,mamicode.com
首页 > Windows程序 > 详细

物流跟踪API-快递单推送

时间:2020-02-11 23:07:25      阅读:664      评论:0      收藏:0      [点我收藏+]

标签:轨迹   物流   time   center   快递单号   body   文件   code   call   

上一篇文章我们讲解了订阅服务功能。我们已经完成了如何把物流订单订阅到快递鸟,快递鸟也能接收到我们的订单信息,接下来就需要快递鸟实时的将最新的物流轨迹推送到我们服务器,我们既然要接收快递鸟的信息,就需要提供一个服务地址给快递鸟,以C#为列,我们新建一个接收页面,我的接收文件: testReceive.aspx,把他部署到服务器,

接收地址:http://www.你的域名.com/testReceive.aspx

登陆快递鸟官网,通过快递鸟提供的沙箱调试页面进去测试接口

调试页面地址:

http://kdniao.com/UserCenter/v2/SandBox/PushQueryParam.aspx

 

测试的截图:

 技术图片

 

一、接口描述/说明

推送接口(商户实现)

(1)客户需要按快递鸟要求开发接口,保证信息的正常接收。
(2)快递鸟主动推送时,物流信息接收接口由客户提供。
(3)接口支持的消息接收方式为HTTP POST,请求方法的编码格式(utf-8):"application/x-www-form-urlencoded;charset=utf-8"。
(4)运单物流信息全量推送(每次推送的运单物流信息包括运单当前所有的的物流信息)。

请求系统级参数说明:

参数名称

类型

说明

必须要求

RequestData

String

请求内容需进行URL(utf-8)编码。请求内容只支持JSON格式。

R

RequestType

String

101-轨迹查询结果, 107-货款状态

R

DataSign

String

数据内容签名(把(请求内容(未编码)+AppKey)进行MD5加密,然后Base64编码)

R

备注:R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional)

 

二、接口参数

推送接口

应用级输入参数

参数名称

类型

说明

必须要求

EBusinessID

String

用户电商ID

R

PushTime

String

推送时间

R

Count

String

推送物流单号轨迹个数

R

Data

String

推送物流单号轨迹集合

R

订阅查询结果(RequestType:101)

通过轨迹查询(订阅查询)接口订阅到快递鸟的数据,快递鸟推送时,会将推送的RequestType的值置为101,同时返回下列数据

请求内容字段定义:

参数

类型

说明

必须要求

Data

EBusinessID

String

商户ID

O

ShipperCode

String

快递公司编码

R

LogisticCode

String

快递单号

R

Success

Bool

成功与否:true,false

R

Reason

String

失败原因

O

State

String

物流状态: 0-无轨迹,1-已揽收,2-在途中,3-签收,4-问题件

R

CallBack

String

订阅接口的Bk值

O

Traces

Traces

AcceptTime

String

时间

R

AcceptStation

String

描述

R

Remark

String

备注

O

EstimatedDeliveryTime

String

预计到达时间yyyy-mm-dd

O

货款状态(RequestType:107)

用户通过电子面单使用快递鸟货到付款等金融服务时,快递鸟会将该订单的金融状态通过接口推送给用户。

请求内容字段定义:

参数名称

类型

说明

必须要求

Data

EBusinessID

String

用户电商ID

O

OrderCode

String

订单编号

O

ShipperCode

String

快递公司编码

R

LogisticCode

String

物流运单号

R

Success

Bool

成功与否

R

Reason

String

失败原因

O

State

String

物流状态:0-无轨迹,1-已揽收, 2-在途中 201-到达派件城市,3-签收,4-问题件

R

CallBack

String

订阅接口的Bk值

O

OrderState

String

订单货款状态:1-待出款;2-已出款;3-已收款

O

AccountName

String

返款银行卡开户人(例:**伟、*佳)

O

AccountTel

String

返款银行卡手机末四位

O

AccountNum

String

返款银行卡末四位

O

返回参数定义

参数名称

类型

说明

必须要求

EBusinessID

String

用户ID

R

UpdateTime

String

时间

R

Success

Bool

成功与否:true,false

R

Reason

String

失败原因

O

 

推送接口(商户实现)

请求示例 JSON (订阅查询结果)

{

        "EBusinessID": "1109259",

        "Count": "2",

        "PushTime": "2015-3-11 16:21:06",

        "Data": [

            {

                "EBusinessID": "1109259",

                "OrderCode": "",

                "ShipperCode": "EMS",

                "LogisticCode": "5042260908504",

                "Success": true,

                "Reason": "",

                "State": "2",

                "CallBack": "0",

                "Traces": [

                    {

                        "AcceptTime": "2015-03-06 21:16:58",

                        "AcceptStation": "深圳市横岗速递营销部已收件,(揽投员姓名:钟定基;联系电话:)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-07 14:25:00",

                        "AcceptStation": "离开深圳市 发往广州市",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-08 00:17:00",

                        "AcceptStation": "到达广东速递物流公司广航中心处理中心(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-08 01:15:00",

                        "AcceptStation": "离开广州市 发往北京市(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-09 09:01:00",

                        "AcceptStation": "到达北京黄村转运站处理中心(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-09 18:39:00",

                        "AcceptStation": "离开北京市 发往呼和浩特市(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-10 18:06:00",

                        "AcceptStation": "到达  呼和浩特市 处理中心",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-11 09:53:48",

                        "AcceptStation": "呼和浩特市邮政速递物流分公司金川揽投部安排投递(投递员姓名:安长虹;联系电话:18047140142)",

                        "Remark": ""

                    }

                ]

            },

            {

                "EBusinessID": "1109259",

                "OrderCode": "",

                "ShipperCode": "EMS",

                "LogisticCode": "5042260943004",

                "Success": true,

                "Reason": "",

                "State": "2",

                "CallBack": "0",

                "Traces": [

                    {

                        "AcceptTime": "2015-03-07 15:26:09",

                        "AcceptStation": "深圳市横岗速递营销部已收件,(揽投员姓名:周宏彪;联系电话:13689537568)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-08 16:32:00",

                        "AcceptStation": "离开深圳市 发往广州市",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-09 00:58:00",

                        "AcceptStation": "到达广东速递物流公司广航中心处理中心(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-09 01:15:00",

                        "AcceptStation": "离开广州市 发往北京市(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-10 05:20:00",

                        "AcceptStation": "到达北京黄村转运站处理中心(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-10 11:59:00",

                        "AcceptStation": "离开北京市 发往廊坊市(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-10 14:23:00",

                        "AcceptStation": "到达廊坊市处理中心(经转)",

                        "Remark": ""

                    },

                    {

                        "AcceptTime": "2015-03-11 08:55:00",

                        "AcceptStation": "离开廊坊市 发往保定市(经转)",

                        "Remark": ""

                    }

                ]

            }

        ]

    }

请求示例 JSON格式 (货款状态)

{

              "EBusinessID": "1109259",

              "Count": "2",

              "PushTime": "2015-3-11 16:21:06",

              "Data": [

                  {

                      "EBusinessID": "1109259",

                      "OrderCode": "",

                      "ShipperCode": "EMS",

                      "LogisticCode": "5042260908504",

                      "Success": true,

                      "Reason": "",

                      "State": "2",

                      "CallBack": "0",

                      "OrderState":"1",

                      "AccountName":"张三",

                      "AccountTel":"13800000000",

                      "AccountNum":"0321"

                  },

                  {

                      "EBusinessID": "1109259",

                      "OrderCode": "",

                      "ShipperCode": "EMS",

                      "LogisticCode": "5042260908522",

                      "Success": true,

                      "Reason": "",

                      "State": "2",

                      "CallBack": "0",

                      "OrderState":"1",

                      "AccountName":"张三",

                      "AccountTel":"13800000011",

                      "AccountNum":"0321"

                  }

              ]

          }

返回示例 JSON

{

        "EBusinessID": "1151847",

        "UpdateTime": "2016-08-09 16:42:38",

        "Success": true,

        "Reason": ""

        }

 

 

 

提供源码下载:

https://download.csdn.net/download/yanghanwen/12139326

 

调用第三方物流接口,替换自己的key就能直接使用,主要实现了物流在线轨迹查询,订单订阅,轨迹推送,支持500多家的快递查询接口,包括主流的四通一达,支持上门取件服务,其他接口调用,修改调用指令和参数就能实现。

 

物流跟踪API-快递单推送

标签:轨迹   物流   time   center   快递单号   body   文件   code   call   

原文地址:https://www.cnblogs.com/51api/p/12297287.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!