API接口

一、基本信息

1.通信方式:

HTTP的POST方法

2.数据格式

响应数据采用JSON

3.请求参数

所有数据均为字符型.

Key(必填参数)

请求key(32位),公司提供给合作网站的识别字符串,用于识别和鉴定请求来源,避免未授权的非法访问

其它参数

按实际需要填写,见下面接口说明

4.响应数据

Code

结果状态码

200 - 成功返回

600 – 服务器异常

603 – 参数错误

Message

描述返回错误信息

二、API说明

1.查单

/Api/Track.ashx

请示参数:

POST参数名

是否必填

说明

Key

公司发放的key

Orders

运单号,多个用英文逗号隔开(,).一次最多查10个运单

ExpressDomain

快递公司域名

 

返回对象 Response

属性名

说明

Code

状态码

200 - 成功返回

600 – 服务器异常

603 – 参数错误

 

Message

描述返回错误信息

Datas

TrackModel数组 - 运单的信息, TrackModel具体见下表

 

返回对象 TrackModel

属性名

说明

OrderNum

运单号

Datas

TrackDatasModel数组 – 轨迹信息数组, TrackDatasModel具体见下表

 

返回对象 TrackDatasModel

属性名

说明

Time

时间

Desc

轨迹描述

 

成功返回或失败返回参数,请见示例

示例

成功返回值:

{

  "Code": "200",

  "Datas": [

    {

      "OrderNum": "MLD104487697",

      "Datas": [

        {

          "Time": "2/5/2018 5:24:09 PM",

          "Desc": "运单创建"

        },

        {

          "Time": "2/5/2018 5:24:09 PM",

          "Desc": "等待处理"

        }

      ]

    },

    {

      "OrderNum": "AD104488001",

      "Datas": [

        {

          "Time": "2/5/2018 6:16:51 PM",

          "Desc": "运单创建"

        }

      ]

    },

    {

      "OrderNum": "AD104432189",

      "Datas": [

        {

          "Time": "9/27/2017 7:01:19 PM",

          "Desc": "运单创建"

        },

        {

          "Time": "9/27/2017 7:01:19 PM",

          "Desc": "等待处理"

        },

        {

          "Time": "9/30/2017 8:14:35 AM",

          "Desc": "包裹扫描入库USLA"

        },

        {

          "Time": "9/30/2017 9:15:11 AM",

          "Desc": "包裹已出库USLA"

        },

        {

          "Time": "9/30/2017 10:15:45 AM",

          "Desc": "已发往洛杉矶国际机场LAX"

        },

        {

          "Time": "10/1/2017 2:16:19 AM",

          "Desc": "飞往中国"

        },

        {

          "Time": "10/3/2017 9:59:30 AM",

          "Desc": "抵达海关,等候清关"

        },

        {

          "Time": "10/6/2017 2:30:18 PM",

          "Desc": "海关清关中"

        },

        {

          "Time": "10/9/2017 5:36:59 PM",

          "Desc": "已清关完毕等待转运单号中"

        },

        {

          "Time": "10/9/2017 12:00:00 AM",

          "Desc": "派送单号:中速速递 535147836512"

        }

      ]

    }

  ]

}

 

失败返回值:

{

    "Code": "600",

    "Message": "Key Error!",

}

2.门市订单批量下单

/Api/CreateLabels.ashx

请示参数:

POST参数名

是否必填

说明

Key

快递公司发放的key

Data

Order订单Json数组,Data参数需要进行 URL 编码传输(某些语言发送数据 时可能会自动进行 URL 编码,此时便无需再进行 URL 编码)

 Order对象

<% if (CommonEx.ConstPara.BAOXIANG_TYPE == CommonEx.ConstPara.BAOXIANG_TYPE_1) { %> <%}else{ %> <%}%>

参数名

是否必填

类型

说明

OrderNum

String

订单号,大于8位,需要有权限,空则自动生成。如无权限,则无需填写

SenderPhone

String

发件人电话

SenderAddr

String

发件人地址

RecvName

String

收件人名字

RecvPhone

String

收件人电话

RecvProvince

String

收件人省份

RecvCity

String

收件人城市

RecvDistrict

String

收件人区

RecvAddr

String

收件人地址

RecvPostalCode

String

收件人邮编

IdNo

String

收件人身份证号

Weight

Decimal 2位小数

包裹重量,无权限时无效

IsInsure

Bool

是否购买保险,购买保险需要填写货物价格

Insure

Int

保额,最大为2000

OrderItem

List<OrderItem>

货物详情

 

OrderItem对象

参数名

是否必填

类型

说明

Title

String

中文名称

BrandName

String

英文品牌

Price

Int

单价

Quantity

Int

数量

Sku

String

SKU

Weight

Decimal 2位小数

重量

Unit

String

单位。个/件/支/双/包/袋/套/罐/盒/板/条/瓶/桶/箱/块/组/片/张/把/台。默认为件

Specifications

String

规格

CategoryName

String

类别,请向业务员获取分类列表

 

返回对象 Response

属性名

说明

Code

状态码

200 - 成功返回

600 – 服务器异常

603 – 参数错误

 

Message

描述返回错误信息

Order

Order Json数组 – 订单的信息

 

示例

请求:

Data=[{

    "SenderName": "陈先",

    "SenderPhone": "6266152742",

    "SenderAddr": "6266152742",

    "RecvName": "test",

    "RecvPhone": "6266152742",

    "RecvAddr": "test",

    "RecvPostalCode": "510000",

    "Weight": 1.111,

    "OrderNum": "",

    "OrderItems": [{

        "Title": "title",

        "BrandName": "BrandName",

        "Price": "11",

        "Quantity": 2,

        "Weight": 1.11,

        "Specifications": "Specifications",

        "CategoryName": "CategoryName"

    }, {

        "Title": "title",

        "BrandName": "BrandName",

        "Price": "12",

        "Quantity": 2,

        "Weight": 1.11,

        "Specifications": "Specifications",

        "CategoryName": "CategoryName"

    }]

}, {

    "SenderName": "陈先",

    "SenderPhone": "6266152742",

    "SenderAddr": "6266152742",

    "RecvName": "test",

    "RecvPhone": "6266152742",

    "RecvAddr": "test",

    "RecvPostalCode": "510000",

    "Weight": 1.111,

    "OrderItems": [{

        "Title": "title",

        "BrandName": "BrandName",

        "Price": "11",

        "Quantity": 2,

        "Weight": 1.11,

        "Specifications": "Specifications",

        "CategoryName": "CategoryName"

    }, {

        "Title": "title",

        "BrandName": "BrandName",

        "Price": "12",

        "Quantity": 2,

        "Weight": 1.11,

        "Specifications": "Specifications",

        "CategoryName": "CategoryName"

    }]

}]&Key=88888888888888888888888888888888

返回值:

{"Code":"200","Message":null,"Orders":[{"SenderName":"陈先","SenderPhone":"6266152742","SenderAddr":"6266152742","RecvName":"test","RecvPhone":"6266152742","RecvProvince":null,"RecvCity":null,"RecvDistrict":null,"RecvAddr":"test","RecvPostalCode":"510000","IdNo":null,"Weight":1.111,"InsureType":0,"Insure":0,"OrderNum":"KV10643479602","OrderItems":[{"Title":"title","BrandName":"BrandName","Price":11,"Quantity":2,"Sku":null,"Weight":1.11,"Unit":"件","Specifications":"Specifications","CategoryName":"CategoryName"},{"Title":"title","BrandName":"BrandName","Price":12,"Quantity":2,"Weight":1.11,"Specifications":"Specifications","CategoryName":"CategoryName","Sku":null,"Unit":"件"}]},{"SenderName":"陈先","SenderPhone":"6266152742","SenderAddr":"6266152742","RecvName":"test","RecvPhone":"6266152742","RecvAddr":"test","RecvPostalCode":"510000","Weight":1.111,"OrderNum":"KV10643483681","OrderItems":[{"Title":"title","BrandName":"BrandName","Price":11,"Quantity":2,"Weight":1.11,"Specifications":"Specifications","CategoryName":"CategoryName","Sku":null,"Unit":"件"},{"Title":"title","BrandName":"BrandName","Price":12,"Quantity":2,"Weight":1.11,"Specifications":"Specifications","CategoryName":"CategoryName","Sku":null,"Unit":"件"}],"RecvProvince":null,"RecvCity":null,"RecvDistrict":null,"IdNo":null,"InsureType":0,"Insure":0}]}

 

2.订单面单打印

/Api/PrintLabel.ashx

请示参数:

POST参数名

是否必填

说明

Key

快递公司发放的key

OrderNum

订单号

 

返回对象 Response

属性名

说明

Code

状态码

200 - 成功返回

600 – 服务器异常

603 – 参数错误

 

Message

描述返回错误信息

LabelUrl

面单Url

 

示例

请求:

OrderNum=8888888888&Key=88888888888888888888888888888888

返回值:

{"Code":"603","Message":"不能打印不属于你的订单","LabelUrl":null}
{"Code":"603","Message":"订单不存在","LabelUrl":null}
{"Code":"200","Message":null,"LabelUrl":"http:///\\print\\/11525/3c12e344-fdff-4a13-af7f-8fa8e3384f5d.pdf"}