API接口
一、基本信息
1.通信方式:
HTTP的POST方法
2.数据格式
响应数据采用JSON
3.请求参数
Head ContentType : application/x-www-form-urlencoded
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对象
参数名 |
是否必填 |
类型 |
说明 |
OrderNum |
否 |
String |
订单号,大于8位,需要有权限,空则自动生成。如无权限,则无需填写 |
ChannelCode |
否 |
String |
渠道代码 |
SenderName |
是 |
String |
发件人名字 |
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 |
是否购买保险,购买保险需要填写货物价格 |
OrderItems |
是 |
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": "6267104685",
"SenderAddr": "6267104685",
"RecvName": "test",
"RecvPhone": "6267104685",
"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": "6267104685",
"SenderAddr": "6267104685",
"RecvName": "test",
"RecvPhone": "6267104685",
"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":"6267104685","SenderAddr":"6267104685","RecvName":"test","RecvPhone":"6267104685","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":"6267104685","SenderAddr":"6267104685","RecvName":"test","RecvPhone":"6267104685","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}]}
3.订单面单打印
/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"}
4.上传身份证
/Api/UploadID.ashx
请示参数:
POST参数名 |
是否必填 |
说明 |
Key |
是 |
快递公司发放的key |
Type |
是 |
Type : 0表示根据运单号上传,1表示根据手机号上传 |
OrderNum |
否 |
订单号,Type=0时必填 |
PhoneNum |
否 |
手机号,Type=1时必填 |
RecvName |
是 |
收件人名 |
IdNum |
是 |
身份证号码 |
IdFront |
是 |
身份证正面图片 FormData |
IdBlack |
是 |
身份证反面图片 FormData |
返回对象 Response
属性名 |
说明 |
Code |
状态码 200 - 成功返回 600 – 服务器异常 603 – 参数错误
|
Message |
描述返回错误信息 |
6.渠道列表
/Api/ChannelList.ashx
请示参数:
POST参数名 |
是否必填 |
说明 |
Key |
是 |
快递公司发放的key |
返回对象 Response
属性名 |
说明 |
Code |
状态码 200 - 成功返回 600 – 服务器异常 603 – 参数错误
|
Message |
描述返回错误信息 |
Data |
渠道列表Json |
示例
请求:
Key=88888888888888888888888888888888
返回值:
{
"Code": "200",
"Message": null,
"Data": [
{
"Name": "未知口岸",
"Code": "N"
},
{
"Name": "A-个人物品",
"Code": "A"
},
{
"Name": "包税一类",
"Code": "B1"
},
{
"Name": "包税二类",
"Code": "B2"
},
]
}