快递查询(快递单号智能识别/快递公司+快递单号)-完整提供 Demo 代码示例及数据专业且全面的 API 查询接口
更多资料请参考:www.woyaocha.net/product/express
查询说明
快递单号智能识别,是根据查询的快递单号自动智能识别出该运单所属的快递公司,再获取快递公司及实时的运单状态和运单状态等信息。
快递公司+快递单号,是根据查询的快递公司和快递单号,获取快递公司及实时的运单状态和运单状态等信息。
接口描述
功能描述
URL 示例
http://cha.ebaitian.cn/api/json?appid=xxx&module=getExpressInfo&order=xxx&sign=xxx
http://cha.ebaitian.cn/api/json?type=get&appid=xxx&module=getExpressInfo&order=xxx&sign=xxx
https://cha.ebaitian.cn/api/json?appid=xxx&module=getExpressInfo&order=xxx&sign=xxx
https://cha.ebaitian.cn/api/json?type=get&appid=xxx&module=getExpressInfo&order=xxx&sign=xxx
http://cha.ebaitian.cn/api/json?appid=xxx&module=getExpressInfoNoSmart&company=xxx&order=xxx&sign=xxx
http://cha.ebaitian.cn/api/json?type=get&appid=xxx&module=getExpressInfoNoSmart&company=xxx&order=xxx&sign=xxx
https://cha.ebaitian.cn/api/json?appid=xxx&module=getExpressInfoNoSmart&company=xxx&order=xxx&sign=xxx
https://cha.ebaitian.cn/api/json?type=get&appid=xxx&module=getExpressInfoNoSmart&company=xxx&order=xxx&sign=xxx
请求参数
数据包体
{"type": "get","appid": "1000xxxx","module": "getExpressInfo","order": "247198050163","sign": "ecab4881ee80ad3d76bb1da68387428ca752eb885e52621a3129dcf4d9bc4fd4"
}
{"type": "get","appid": "1000xxxx","module": "getExpressInfoNoSmart","company": "shunfeng","order": "247198050163","sign": "ecab4881ee80ad3d76bb1da68387428ca752eb885e52621a3129dcf4d9bc4fd4"
}
参数说明
参数 | 必选 | 类型 | 描述 |
---|---|---|---|
type | 否 | string | 授权接口的请求方式 |
appid | 是 | string | 授权接口的 AppID,请填写您在我要查官网上申请到的 AppID |
module | 是 | string | 目标请求的数据模块,根据快递单号智能查询快递信息为:getExpressInfo |
order | 是 | string | 目标要查询的快递单号,支持的快递公司及参数对照见下面的其他说明 |
sign | 是 | string | 请求凭证,具体计算方式见下面的其他说明 |
参数 | 必选 | 类型 | 描述 |
---|---|---|---|
type | 否 | string | 授权接口的请求方式 |
appid | 是 | string | 授权接口的 AppID,请填写您在我要查官网上申请到的 AppID |
module | 是 | string | 目标请求的数据模块,根据快递公司和快递单号查询快递信息为:getExpressInfoNoSmart |
company | 是 | string | 目标要查询的快递公司,支持的快递公司及参数对照见下面的快递公司代码,代码或扩展代码均可 |
order | 是 | string | 目标要查询的快递单号,支持的快递公司及参数对照见下面的快递公司代码 |
sign | 是 | string | 请求凭证,具体计算方式见下面的其他说明 |
快递公司代码
序号 | 快递公司代码 | 扩展代码 | 快递公司 |
---|---|---|---|
1 | 360zebra | ZY_BM | 斑马物联网(360zebra) |
2 | 8europe | ZY_BOZ | 败欧洲(8europe) |
3 | aae | AAE | AAE快递 |
4 | acscourier | ACS | ACS Courier |
5 | afghan_post | IAFHYZ | 阿富汗邮政(Afghan Post) |
6 | aj | AJ | 安捷快递 |
7 | al8856 | ALKJWL | 阿里电商物流(Ali Business Logistics) |
8 | aland_post | IALQDYZ | 奥兰群岛芬兰邮政(aland Post) |
9 | an_post | IE | 爱尔兰邮政(An Post) |
10 | anwl | ANE | 安能物流 |
11 | aramex | ARAMEX | Aramex |
12 | armenia_post | IYMNYYZ | 亚美尼亚邮政(Armenia Post) |
13 | aruba_post | IALBYZ | 阿鲁巴邮政(Aruba Post) |
14 | auexpress | AYCA | 澳邮中国快运(Auexpress) |
15 | aus | ZY_AUSE | 澳世速递(Ausworld Express) |
16 | australia_post | IADLYYZ | 澳大利亚邮政(Australia Post) |
17 | austria_post | AT | 奥地利邮政(Austrian Post) |
18 | azerbaijan_post | IASBJYZ | 阿塞拜疆邮政(Azerbaijan Post) |
19 | bahrain-post | IBLYZ | 巴林邮政(Bahrain Post) |
20 | bangladesh_ems | IMJLGEMS | 孟加拉国 EMS(Bangladesh EMS) |
21 | beihaiguoji | BHGJ | 贝海国际速递 |
22 | belgium_post | BEL | 比利时邮政(Bpost) |
23 | belpochta | IBELSYZ | 白俄罗斯邮政(Belarus Post) |
24 | bermuda_post | IBMDYZ | 百慕大邮政(Bermuda Post) |
25 | huitong | HTKY | 百世汇通快递 |
26 | bfdf | BFDF | 百福东方 |
27 | bhutan_post | BUDANYOUZH | 不丹邮政(Bhutan Post) |
28 | bosnia_and_herzegovina_post | IBHYZ | 波黑邮政(Bosnia And Herzegovina Post) |
29 | botswana_post | IBCWNYZ | 博茨瓦纳邮政(Botswana Post) |
30 | brazil_correios | BR | 巴西邮政(Brazil Correios) |
31 | brunei_post | IWLYZ | 文莱邮政(Brunei Post) |
32 | bulgaria_post | IBJLYYZ | 保加利亚邮政(Bulgaria Post) |
33 | cambodia_post | IJPZYZ | 柬埔寨邮政(Cambodia Post) |
34 | canada_post | CA | 加拿大邮政(Canada Post) |
35 | cdek | CDEK | CDEK快递 |
36 | chengguang | CG | 程光快递 |
37 | chengji | CJKD | 城际快递 |
38 | chinz56 | QYHY | 秦远物流 |
39 | chukou1 | CKY | 出口易物流 |
40 | colombia_post | IGLBYYZ | 哥伦比亚邮政(Colombia Post) |
41 | correo_argentino | IAGTYZ | 阿根廷邮政(Argentino Post) |
42 | correos_chile | IZLYZ | 智利邮政(Correos Chile) |
43 | correos_mexico | IMXGYZ | 墨西哥邮政(Mexico Post) |
44 | correos_spain | IXBYYZ | 西班牙邮政(Correos) |
45 | cs | CITY100 | 城市100快递 |
46 | cxwl | CXHY | 传喜物流 |
47 | czech_post | IJKYZ | 捷克邮政 |
48 | dadaowuliu | DDWL | 大道物流 |
49 | debang | DBL | 德邦物流 |
50 | dhl | DHL | DHL快递 |
51 | dpe_express | DBYWL | 递必易 |
52 | ds | DSWL | D速快递 |
53 | dsf | D4PX | 递四方速递 |
54 | dtwl | DTWL | 大田物流 |
55 | ems | EMS | EMS快递 |
56 | ewe | EWE | ewe快递 |
57 | fanyu | FYKD | 凡宇快递 |
58 | fastgo | FASTGO | 速派快递FastGo(Fastgo) |
59 | fedexcn | FEDEX | FEDEX国内快递 |
60 | feiyang | ZY_FY | 飞洋快递 |
61 | fkd | FKD | 飞康达快递 |
62 | flytexpress | IFTWL | 飞特物流(Flyt Express) |
63 | ftd | FTD | 富腾达快递 |
64 | gdems | GDEMS | 广东ems快递 |
65 | gsdwl | GSD | 共速达物流 |
66 | gtsd | GTSD | 高铁速递 |
67 | guada | GD | 冠达快递 |
68 | guangtong | GTONG | 广通速递 |
69 | guotong | GTO | 国通快递 |
70 | henglu | HLWL | 恒路物流 |
71 | hhexp | HHWL | 华翰物流 |
72 | hong_kong_post | XGYZ | 香港邮政(Hong Kong Post) |
73 | huaqi | HQKD | 华企快递 |
74 | huiqiang | ZHQKD | 汇强快递 |
75 | hxlwl | HXLWL | 华夏龙物流 |
76 | japan_post | JP | 日本邮政(Japan Post) |
77 | jiayunmei | JYM | 加运美快递 |
78 | jiete | JTKD | 捷特快递 |
79 | jingdong | JD | 京东快递 |
80 | jingguang | JGSD | 京广快递 |
81 | jinyue | JYKD | 晋越快递 |
82 | jldt | JLDT | 嘉里大通物流 |
83 | jywl | JYWL | 佳怡物流 |
84 | korea_post | IHGYZ | 韩国邮政(Korea Post) |
85 | kuaijie | FAST | 快捷快递 |
86 | kysy | KYSY | 跨越速运 |
87 | lianhaotong | LHT | 联昊通快递 |
88 | lijisong | LJSKD | 立即送 |
89 | longbang | LB | 龙邦快递 |
90 | minbang | MB | 民邦快递 |
91 | minhang | MHKD | 民航快递 |
92 | ocs | OCS | OCS快递 |
93 | pakistan_post | IBJSTYZ | 巴基斯坦邮政(Pakistan Post) |
94 | parcel_force | IYGYZ | 英国邮政(Parcel Force) |
95 | pinganda | PADTF | 平安达快递 |
96 | pinjun | PJ | 品骏快递 |
97 | qichen | VENUCIA | 启辰国际物流(venucia) |
98 | quanchen | QCKD | 全晨快递 |
99 | quanfeng | QFKD | 全峰快递 |
100 | quanritong | QRT | 全日通快递 |
101 | quanyi | UAPEX | 全一快递 |
102 | rrs | RRS | 日日顺物流 |
103 | rufengda | RFD | 如风达快递 |
104 | saiaodi | SAD | 赛澳递 |
105 | shengan | SAWL | 圣安物流 |
106 | shengfeng | SFWL | 盛丰物流 |
107 | shenghui | SHWL | 盛辉物流 |
108 | shentong | STO | 申通快递 |
109 | shunfeng | SF | 顺丰快递 |
110 | stwl | ST | 速通物流 |
111 | suer | SURE | 速尔快递 |
112 | suning | SNWL | 苏宁快递 |
113 | suteng | STWL | 速腾快递 |
114 | tdhy | HOAU | 天地华宇 |
115 | tiantian | HHTT | 天天快递 |
116 | tnt | TNT | TNT快递 |
117 | ubonex | UBONEX | 优邦速运 |
118 | ups | UPS | UPS国际快递 |
119 | weitepai | WTP | 微特派快递 |
120 | wxwl | WXWL | 万象物流 |
121 | xdexpress | XD | 迅达速递 |
122 | xfwl | XFEX | 信丰物流 |
123 | xinbang | XBWL | 新邦物流 |
124 | xinjie | XJ | 新杰物流 |
125 | yad | YADEX | 源安达快递 |
126 | yafeng | YFSD | 亚风快递 |
127 | ycky | YCWL | 远成快运 |
128 | ycwl | YCWL | 远成物流 |
129 | yitongda | IYTG | 易通达 |
130 | ymdd | YMDD | 壹米滴答物流 |
131 | yousu | UC | 优速快递 |
132 | yuanfeihang | YFHEX | 原飞航快递 |
133 | yuantong | YTO | 圆通快递 |
134 | yuefeng | YFEX | 越丰快递 |
135 | yunda | YD | 韵达快递 |
136 | bgpyghx | YZPY | 邮政包裹、平邮、挂号信 |
137 | zengyi | ZENY | 增益快递 |
138 | zhongtie | ZTKY | 中铁快运 |
139 | zhongtong | ZTO | 中通快递 |
140 | zhongyou | CNPEX | 中邮物流 |
141 | zjs | ZJS | 宅急送快递 |
其他说明
string type = "get"; //请求方式,可以赋值为:post
string appid = "1000xxxx"; //sdkappid 对应的 appid,需要业务方高度保密
string module = "getExpressInfo"; //请求的数据模块,此处赋值:getExpressInfo
string order = "247198050163"; //要查询的快递单号
string sign = sha256(appid=1000xxxx&module=getExpressInfo&order=247198050163&appkey=56cf61af4b7897e704f67deb88ae8f24);
string type = "get"; //请求方式,可以赋值为:post
string appid = "1000xxxx"; //sdkappid 对应的 appid,需要业务方高度保密
string module = "getExpressInfoNoSmart"; //请求的数据模块,此处赋值:getExpressInfoNoSmart
string company = "shunfeng"; //要查询的快递公司
string order = "247198050163"; //要查询的快递单号
string sign = sha256(appid=1000xxxx&module=getExpressInfoNoSmart&company=shunfeng&order=247198050163&appkey=56cf61af4b7897e704f67deb88ae8f24);
响应参数
数据包体
{"result":1,"description":"TRUE","flag":"","expressInfo":{"id":"shunfeng","name":"顺丰快递","order":"247198050163","message":"","errcode":"0000","status":4,"data":[{"time":"2018-06-06 17:20:22","content":"顺丰速运 已收取快件"},{"time":"2018-06-06 19:37:16","content":"快件在【武汉硚口区硚口营业点】已装车,准备发往 【武汉走马岭集散中心】"},{"time":"2018-06-06 19:47:53","content":"快件已发车"},{"time":"2018-06-06 20:51:13","content":"快件到达 【武汉走马岭集散中心】"},{"time":"2018-06-06 20:53:46","content":"快件在【武汉走马岭集散中心】已装车,准备发往下一站"},{"time":"2018-06-06 21:26:00","content":"快件已发车"},{"time":"2018-06-06 22:17:29","content":"快件到达 【武汉总集散中心】"},{"time":"2018-06-07 00:08:13","content":"快件在【武汉总集散中心】已装车,准备发往下一站"},{"time":"2018-06-07 03:16:03","content":"快件到达 【杭州总集散中心】"},{"time":"2018-06-07 05:45:20","content":"快件在【杭州总集散中心】已装车,准备发往下一站"},{"time":"2018-06-07 08:57:00","content":"快件到达 【福州总集散中心】"},{"time":"2018-06-07 08:57:30","content":"快件在【福州总集散中心】已装车,准备发往 【福州尚干集散中心】"},{"time":"2018-06-07 09:30:24","content":"快件已发车"},{"time":"2018-06-07 10:31:35","content":"快件到达 【福州尚干集散中心】"},{"time":"2018-06-07 11:16:19","content":"快件在【福州尚干集散中心】已装车,准备发往 【泉州晋江集散中心】"},{"time":"2018-06-07 12:17:36","content":"快件已发车"},{"time":"2018-06-07 15:26:19","content":"快件到达 【泉州晋江集散中心】"},{"time":"2018-06-07 15:52:54","content":"快件在【泉州晋江集散中心】已装车,准备发往下一站"},{"time":"2018-06-07 17:16:21","content":"快件已发车"},{"time":"2018-06-07 17:52:49","content":"快件到达 【泉州丰泽招丰村路营业点】"},{"time":"2018-06-08 08:23:14","content":"快件交给周松寿,正在派送途中(联系电话:15906062987)"},{"time":"2018-06-08 09:38:23","content":"快件派送至【丰巢智能快递柜】,请您凭取件码至电力职业技术学院原二号教学楼旁车库领取您的快递."},{"time":"2018-06-08 15:38:40","content":"已签收(丰巢签收),感谢使用顺丰,期待再次为您服务"}]}
}
参数说明
参数 | 必选 | 类型 | 描述 |
---|---|---|---|
result | 是 | string | 接口响应结果:0-失败;1-成功 |
description | 是 | string | 接口响应描述:一般为 TURE(result=1) 与 FALSE(result=0),或者返回错误信息 |
flag | 否 | string | 错误说明,没有错误则返回空 |
expressInfo | 是 | object | 返回手机号码归属地信息 |
参数 | 必选 | 类型 | 描述 |
---|---|---|---|
id | 是 | string | 快递公司代码,如:顺丰-shunfeng、申通-shentong,具体请查看上面的快递公司代码 |
name | 是 | string | 快递公司名称 |
order | 是 | string | 快递单号,请注意区分大小写 |
message | 否 | string | 输出消息内容(可忽略),一般返回空 |
errcode | 是 | string |
返回错误码: 0-无错误; 1-快递KEY无效; 2-快递代号无效; 3-访问次数达到最大额度; 4-查询服务器返回错误即返回状态码非200; 5-程序执行出错 |
status | 是 | string |
订单跟踪状态: 0-查询出错(即errCode!=0); 1-暂无记录; 2-在途中; 3-派送中; 4-已签收; 5-拒收; 6-疑难件; 7-退回 |
data | 是 | object | 运单跟踪数据集合 |
参数 | 必选 | 类型 | 描述 |
---|---|---|---|
time | 是 | string | 运单时间节点 |
content | 是 | string | 运单时间节点对应的状态 |
SDK 及代码示例
PHP SDK
//接口参数
$api_url='http://cha.ebaitian.cn/api/json';
$api_appid='1000xxxx';
$api_appkey='56cf61af4b7897e704f67deb88ae8f24';//函数,以POST方式提交数据,PHP需要开启CURL函数;数据传输安全,建议使用
function getExpressInfo($order){global $api_url,$api_appid,$api_appkey;$posturl=$api_url;$data='appid='.$api_appid.'&module=getExpressInfo&order='.$order;$sign=hash("sha256",$data.'&appkey='.$api_appkey);$postdata=array("appid"=>$api_appid,"appkey"=>$api_appkey,"module"=>"getExpressInfo","order"=>$order,'sign'=>$sign);$curl = curl_init();curl_setopt($curl, CURLOPT_URL, $posturl);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_POST, 1);curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);$output = curl_exec($curl);curl_close($curl);$obj=json_decode($output);$result=$obj->result;if($result==1){$value=$obj->expressInfo->name;$value.=','.$obj->expressInfo->order;$value.=','.$obj->expressInfo->status;}else{$value=$obj->flag;}return $value;
}
//调用函数
$order='247198050163';
echo getExpressInfo($order);
exit;
//接口参数
$api_url='http://cha.ebaitian.cn/api/json';
$api_appid='1000xxxx';
$api_appkey='56cf61af4b7897e704f67deb88ae8f24';//函数,以GET方式提交数据
function getExpressInfo($order){global $api_url,$api_appid,$api_appkey;$data='appid='.$api_appid.'&module=getExpressInfo&order='.$order;$sign=hash("sha256",$data.'&appkey='.$api_appkey);$info_get=file_get_contents($api_url.'?type=get&'.$data.'&sign='.$sign);$info_json=json_decode($info_get, true);$result=$info_json['result'];if($result==1){$value=$info_json['expressInfo']['name'];$value.=','.$info_json['expressInfo']['order'];$value.=','.$info_json['expressInfo']['status'];}else{$value=$info_json['flag'];}return $value;
}
//调用函数
$order='247198050163';
echo getExpressInfo($order);
exit;
//接口参数
$api_url='http://cha.ebaitian.cn/api/json';
$api_appid='1000xxxx';
$api_appkey='56cf61af4b7897e704f67deb88ae8f24';//函数,以POST方式提交数据,PHP需要开启CURL函数;数据传输安全,建议使用
function getExpressInfo($company,$order){global $api_url,$api_appid,$api_appkey;$posturl=$api_url;$data='appid='.$api_appid.'&module=getExpressInfoNoSmart&company=company&order='.$order;$sign=hash("sha256",$data.'&appkey='.$api_appkey);$postdata=array("appid"=>$api_appid,"appkey"=>$api_appkey,"module"=>"getExpressInfoNoSmart","company"=>$company,"order"=>$order,'sign'=>$sign);$curl = curl_init();curl_setopt($curl, CURLOPT_URL, $posturl);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_POST, 1);curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);$output = curl_exec($curl);curl_close($curl);$obj=json_decode($output);$result=$obj->result;if($result==1){$value=$obj->expressInfo->name;$value.=','.$obj->expressInfo->order;$value.=','.$obj->expressInfo->status;}else{$value=$obj->flag;}return $value;
}
//调用函数
$order='247198050163';
echo getExpressInfo($order);
exit;
//接口参数
$api_url='http://cha.ebaitian.cn/api/json';
$api_appid='1000xxxx';
$api_appkey='56cf61af4b7897e704f67deb88ae8f24';//函数,以GET方式提交数据
function getExpressInfo($company,$order){global $api_url,$api_appid,$api_appkey;$data='appid='.$api_appid.'&module=getExpressInfoNoSmart&company=$company&order='.$order;$sign=hash("sha256",$data.'&appkey='.$api_appkey);$info_get=file_get_contents($api_url.'?type=get&'.$data.'&sign='.$sign);$info_json=json_decode($info_get, true);$result=$info_json['result'];if($result==1){$value=$info_json['expressInfo']['name'];$value.=','.$info_json['expressInfo']['order'];$value.=','.$info_json['expressInfo']['status'];}else{$value=$info_json['flag'];}return $value;
}
//调用函数
$order='247198050163';
echo getExpressInfo($company,$order);
exit;
Java SDK
//以下示例是以 GET 方式请求数据
public class QueryHelper {public static String apiurl="http://cha.ebaitian.cn/api/json";public static String appid="1000xxxx";public static String appkey="56cf61af4b7897e704f67deb88ae8f24";public static String module="getExpressInfo";public static String getSHA256Str(String str){MessageDigest messageDigest;String encdeStr = "";try {messageDigest = MessageDigest.getInstance("SHA-256");byte[] hash = messageDigest.digest(str.getBytes("UTF-8"));encdeStr = Hex.encodeHexString(hash);} catch (NoSuchAlgorithmException e) {e.printStackTrace();} catch (UnsupportedEncodingException e) {e.printStackTrace();}return encdeStr;}public static String get(String urlString) {try {URL url = new URL(urlString);HttpURLConnection conn = (HttpURLConnection) url.openConnection();conn.setConnectTimeout(5 * 1000);conn.setReadTimeout(5 * 1000);conn.setDoInput(true);conn.setDoOutput(true);conn.setUseCaches(false);conn.setInstanceFollowRedirects(false);conn.setRequestMethod("GET"); int responseCode = conn.getResponseCode();if (responseCode == 200) {StringBuilder builder = new StringBuilder();BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(),"utf-8"));for (String s = br.readLine(); s != null; s = br.readLine()) {builder.append(s);}br.close();return builder.toString();}} catch (IOException e) {e.printStackTrace();}return null;}public static String queryExpress(String order){String sign=getSHA256Str("appid="+appid+"&module="+module+"&order="+order+"&appkey="+appkey);String url=apiurl+"?type=get&appid="+appid+"&module="+module+"&order="+order+"&sign="+sign;return get(url);}
}//使用示例
QueryHelper.queryExpress("247198050163");
//以下示例是以 GET 方式请求数据
public class QueryHelper {public static String apiurl="http://cha.ebaitian.cn/api/json";public static String appid="1000xxxx";public static String appkey="56cf61af4b7897e704f67deb88ae8f24";public static String module="getExpressInfoNoSmart";public static String getSHA256Str(String str){MessageDigest messageDigest;String encdeStr = "";try {messageDigest = MessageDigest.getInstance("SHA-256");byte[] hash = messageDigest.digest(str.getBytes("UTF-8"));encdeStr = Hex.encodeHexString(hash);} catch (NoSuchAlgorithmException e) {e.printStackTrace();} catch (UnsupportedEncodingException e) {e.printStackTrace();}return encdeStr;}public static String get(String urlString) {try {URL url = new URL(urlString);HttpURLConnection conn = (HttpURLConnection) url.openConnection();conn.setConnectTimeout(5 * 1000);conn.setReadTimeout(5 * 1000);conn.setDoInput(true);conn.setDoOutput(true);conn.setUseCaches(false);conn.setInstanceFollowRedirects(false);conn.setRequestMethod("GET"); int responseCode = conn.getResponseCode();if (responseCode == 200) {StringBuilder builder = new StringBuilder();BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(),"utf-8"));for (String s = br.readLine(); s != null; s = br.readLine()) {builder.append(s);}br.close();return builder.toString();}} catch (IOException e) {e.printStackTrace();}return null;}public static String queryExpress(String company, String order){String sign=getSHA256Str("appid="+appid+"&module="+module+"&company="+company+"&order="+order+"&appkey="+appkey);String url=apiurl+"?type=get&appid="+appid+"&module="+module+"&company="+company+"&order="+order+"&sign="+sign;return get(url);}
}//使用示例
QueryHelper.queryExpress("shunfeng", "247198050163");
Python SDK
#!/usr/bin/python
# -*- coding: utf-8 -*-
import httplib2
import hashlib
from urllib.parse import urlencode #python3
#from urllib import urlencode #python2apiurl='http://cha.ebaitian.cn/api/json'
appid='1000xxxx'
appkey='56cf61af4b7897e704f67deb88ae8f24'
module='getExpressInfo'
order='247198050163'
data='appid='+appid+'&module='+module+'&order='+order
sign_data=data+'&appkey='+appkey# from Crypto.Cipher import AES
# from Crypto.Hash import SHA256
# 256
hash_256 = hashlib.sha256()
hash_256.update(sign_data.encode('utf-8'))
sign = hash_256.hexdigest()postdata = urlencode({'appid':appid,'module':module,'order':order,'sign':sign})
url = apiurl+'?'+postdata
http = httplib2.Http()
response, content = http.request(url,'GET')
print(content.decode("utf-8"))
#!/usr/bin/python
# -*- coding: utf-8 -*-
import httplib2
import hashlib
from urllib.parse import urlencode #python3
#from urllib import urlencode #python2apiurl='http://cha.ebaitian.cn/api/json'
appid='1000xxxx'
appkey='56cf61af4b7897e704f67deb88ae8f24'
module='getExpressInfoNoSmart'
company='shunfeng'
order='247198050163'
data='appid='+appid+'&module='+module+'&company='+company+'&order='+order
sign_data=data+'&appkey='+appkey# from Crypto.Cipher import AES
# from Crypto.Hash import SHA256
# 256
hash_256 = hashlib.sha256()
hash_256.update(sign_data.encode('utf-8'))
sign = hash_256.hexdigest()postdata = urlencode({'appid':appid,'module':module,'company':company,'order':order,'sign':sign})
url = apiurl+'?'+postdata
http = httplib2.Http()
response, content = http.request(url,'GET')
print(content.decode("utf-8"))
Node.js SDK
//以 POST 方式提交
var http = require('http'); var querystring = require('querystring'); //参数设置
var appid = '1000xxxx';
var appkey = '56cf61af4b7897e704f67deb88ae8f24';
var module = 'getExpressInfo';//目标查询快递单号
var order='247198050163';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256
var sign = SHA256('appid='+appid+'&module='+module+'&order='+order+'&appkey='+appkey);//这是需要提交的数据
var post_data = {appid: appid, module: module,order: order,sign: sign
}; var content = querystring.stringify(post_data); var options = { hostname: 'cha.ebaitian.cn', port: 80, path: '/api/json', method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
}; var req = http.request(options, function (res) { console.log('STATUS: ' + res.statusCode); console.log('HEADERS: ' + JSON.stringify(res.headers)); res.setEncoding('utf8'); res.on('data', function (chunk) { console.log('BODY: ' + chunk); //JSON.parse(chunk)});
}); req.on('error', function (e) { console.log('problem with request: ' + e.message);
}); // write data to request body
req.write(content); req.end();
//以 GET 方式提交
var http = require('http'); var querystring = require('querystring'); //参数设置
var appid = '1000xxxx';
var appkey = '56cf61af4b7897e704f67deb88ae8f24';
var module = 'getExpressInfo';//目标查询快递单号
var order='247198050163';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256
var sign = SHA256('appid='+appid+'&module='+module+'&order='+order+'&appkey='+appkey);//这是需要提交的数据
var data = {appid: appid, module: module,order: order,sign: sign
};var content = querystring.stringify(data); var options = { hostname: 'cha.ebaitian.cn', port: 80, path: '/api/json?' + content, method: 'GET'
}; var req = http.request(options, function (res) { console.log('STATUS: ' + res.statusCode); console.log('HEADERS: ' + JSON.stringify(res.headers)); res.setEncoding('utf8'); res.on('data', function (chunk) { console.log('BODY: ' + chunk);});
}); req.on('error', function (e) { console.log('problem with request: ' + e.message);
}); req.end();
//以 POST 方式提交
var http = require('http'); var querystring = require('querystring'); //参数设置
var appid = '1000xxxx';
var appkey = '56cf61af4b7897e704f67deb88ae8f24';
var module = 'getExpressInfoNoSmart';//目标查询快递公司及快递单号
var company='shunfeng';
var order='247198050163';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256
var sign = SHA256('appid='+appid+'&module='+module+'&company='+company+'&order='+order+'&appkey='+appkey);//这是需要提交的数据
var post_data = {appid: appid, module: module,company: company,order: order,sign: sign
}; var content = querystring.stringify(post_data); var options = { hostname: 'cha.ebaitian.cn', port: 80, path: '/api/json', method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
}; var req = http.request(options, function (res) { console.log('STATUS: ' + res.statusCode); console.log('HEADERS: ' + JSON.stringify(res.headers)); res.setEncoding('utf8'); res.on('data', function (chunk) { console.log('BODY: ' + chunk); //JSON.parse(chunk)});
}); req.on('error', function (e) { console.log('problem with request: ' + e.message);
}); // write data to request body
req.write(content); req.end();
//以 GET 方式提交
var http = require('http'); var querystring = require('querystring'); //参数设置
var appid = '1000xxxx';
var appkey = '56cf61af4b7897e704f67deb88ae8f24';
var module = 'getExpressInfoNoSmart';//目标查询快递公司及快递单号
var company='shunfeng';
var order='247198050163';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256
var sign = SHA256('appid='+appid+'&module='+module+'&company='+company+'&order='+order+'&appkey='+appkey);//这是需要提交的数据
var data = {appid: appid, module: module,company: company,order: order,sign: sign
};var content = querystring.stringify(data); var options = { hostname: 'cha.ebaitian.cn', port: 80, path: '/api/json?' + content, method: 'GET'
}; var req = http.request(options, function (res) { console.log('STATUS: ' + res.statusCode); console.log('HEADERS: ' + JSON.stringify(res.headers)); res.setEncoding('utf8'); res.on('data', function (chunk) { console.log('BODY: ' + chunk);});
}); req.on('error', function (e) { console.log('problem with request: ' + e.message);
}); req.end();
C# SDK
using System;
using System.Collections.Generic;
using System.Web;
using System.Net;
using System.Text;public class getMobileInfo{public static string getInfo(string appid, string appkey, string module, string order){string url = string.Format("http://cha.ebaitian.cn/api/json?type=get&appid={0}&module={1}&order={2}&sgin={3}", appid, module, order, sgin);using (WebClient client = new WebClient()){client.Encoding = Encoding.UTF8;return client.DownloadString(url);}}
}string expressInfo = getMobileInfo.getInfo("1000xxxx", "getExpressInfo", "247198050163", "ecab4881ee80ad3d76bb1da68387428ca752eb885e52621a3129dcf4d9bc4fd4", Request.UserHostAddress);
Console.WriteLine(expressInfo);
Response.Write(expressInfo);
using System;
using System.Collections.Generic;
using System.Web;
using System.Net;
using System.Text;public class getMobileInfo{public static string getInfo(string appid, string appkey, string module, string company, string order){string url = string.Format("http://cha.ebaitian.cn/api/json?type=get&appid={0}&module={1}&company={2}&order={3}&sgin={4}", appid, module, company, order, sgin);using (WebClient client = new WebClient()){client.Encoding = Encoding.UTF8;return client.DownloadString(url);}}
}string expressInfo = getMobileInfo.getInfo("1000xxxx", "getExpressInfoNoSmart", "shunfeng", "247198050163", "ecab4881ee80ad3d76bb1da68387428ca752eb885e52621a3129dcf4d9bc4fd4", Request.UserHostAddress);
Console.WriteLine(expressInfo);
Response.Write(expressInfo);
JavaScript SDK
//使用 JQuery 请先加载最新的 JQuery 插件
//参数设置
var apiurl = 'http://cha.ebaitian.cn/api/json';
var appid = '1000xxxx';
var appkey = '56cf61af4b7897e704f67deb88ae8f24';
var module = 'getExpressInfo';//目标查询快递单号
var order='247198050163';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256
var sign = SHA256('appid='+appid+'&module='+module+'&order='+order+'&appkey='+appkey);//提交数据
$.ajax({url:apiurl,type:'post',dataType:'json',data:{appid:appid,module:module,order:order,sign:sign},success:function(res){console.log(res);}
});
//使用 JQuery 请先加载最新的 JQuery 插件
//参数设置
var apiurl = 'http://cha.ebaitian.cn/api/json';
var appid = '1000xxxx';
var appkey = '56cf61af4b7897e704f67deb88ae8f24';
var module = 'getExpressInfo';//目标查询快递单号
var order='247198050163';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256
var sign = SHA256('appid='+appid+'&module='+module+'&order='+order+'&appkey='+appkey);//提交数据
$.ajax({url:apiurl,type:'post',dataType:'json',data:{appid:appid,module:module,order:order,sign:sign},success:function(res){console.log(res);}
});
//使用 JQuery 请先加载最新的 JQuery 插件
//参数设置
var apiurl = 'http://cha.ebaitian.cn/api/json';
var appid = '1000xxxx';
var appkey = '56cf61af4b7897e704f67deb88ae8f24';
var module = 'getExpressInfoNoSmart';//目标查询快递公司及快递单号
var company='shunfeng';
var order='247198050163';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256
var sign = SHA256('appid='+appid+'&module='+module+'&company='+company+'&order='+order+'&appkey='+appkey);//提交数据
$.ajax({url:apiurl,type:'post',dataType:'json',data:{appid:appid,module:module,company:company,order:order,sign:sign},success:function(res){console.log(res);}
});
//使用 JQuery 请先加载最新的 JQuery 插件
//参数设置
var apiurl = 'http://cha.ebaitian.cn/api/json';
var appid = '1000xxxx';
var appkey = '56cf61af4b7897e704f67deb88ae8f24';
var module = 'getExpressInfoNoSmart';//目标查询快递公司及快递单号
var company='shunfeng';
var order='247198050163';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256
var sign = SHA256('appid='+appid+'&module='+module+'&company='+company+'&order='+order+'&appkey='+appkey);//提交数据
$.ajax({url:apiurl,type:'post',dataType:'json',data:{appid:appid,module:module,company:company,order:order,sign:sign},success:function(res){console.log(res);}
});
ASP SDK
'设置参数
dim apiurl, appid, appkey, module, order, sign
apiurl="http://cha.ebaitian.cn/api/json"
appid="1000xxxx'
appkey="56cf61af4b7897e704f67deb88ae8f24"
module="getExpressInfo"
order="247198050163"'签名,SHA256 不可直接调用;函数参考地址:https://blog.csdn.net/yesoce/article/details/128546
sgin=SHA256("appid=&appid&"&module="&module&"&order="&order&"&appkey="&appkey)'异步提交数据
function PostHTTPPage(url,data)dim Http set Http=server.createobject("MSXML2.SERVERXMLHTTP.3.0")Http.open "POST",url,falseHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"Http.send(data) if Http.readystate<>4 then exit function End ifPostHTTPPage=bytesToBSTR(Http.responseBody,"UTF-8")set http=nothing if err.number<>0 then err.Clear
End function'提交数据
dim postdata, strTest
postdata="appid=&appid&"&module="&module&"&order="&order&"&sign="&sign
strTest=PostHTTPPage(apiurl,postdata)'返回结果
response.write(strTest)
response.end
'设置参数
dim apiurl, appid, appkey, module, company, order, sign
apiurl="http://cha.ebaitian.cn/api/json"
appid="1000xxxx'
appkey="56cf61af4b7897e704f67deb88ae8f24"
module="getExpressInfoNoSmart"
company="shunfeng"
order="247198050163"'签名,SHA256 不可直接调用;函数参考地址:https://blog.csdn.net/yesoce/article/details/128546
sgin=SHA256("appid=&appid&"&module="&module&"&company="&company&"&order="&order&"&appkey="&appkey)'异步提交数据
function PostHTTPPage(url,data)dim Http set Http=server.createobject("MSXML2.SERVERXMLHTTP.3.0")Http.open "POST",url,falseHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"Http.send(data) if Http.readystate<>4 then exit function End ifPostHTTPPage=bytesToBSTR(Http.responseBody,"UTF-8")set http=nothing if err.number<>0 then err.Clear
End function'提交数据
dim postdata, strTest
postdata="appid=&appid&"&module="&module&"&company="&company&"&order="&order&"&sign="&sign
strTest=PostHTTPPage(apiurl,postdata)'返回结果
response.write(strTest)
response.end
常见问题
API 接口参数为空
{"result":0,"description":"API接口参数为空","flag":"appid:sign"
}
解决方法:
1)请检查 appid 及 sign 是否为空;
2)确保 appid 是从官网获取到正确的接口授权;
3)确保 sign 计算生成是正确的。
API 接口参数无效
{"result":0,"description":"API接口参数无效","flag":"appid"
}
解决方法:
1)请检查 appid 是否正确;
2)确保 appid 是从官网获取到正确的接口授权。
API 接口授权已到期
{"result":0,"description":"API接口授权已到期","flag":"end:2018-12-31 23:59:59"
}
解决方法:
1)请检查 appid 对应接口授权的期限是否过期;
2)如果接口授权过期,请到官网更新(免费用户直接更新,无需续费)或续费(针对商业付费用户)。
签名错误
{"result":0,"description":"签名错误","flag":"getExpressInfo->sign"
}
{"result":0,"description":"签名错误","flag":"getExpressInfoNoSmart->sign"
}
请求受限
{"result":0,"description":"请求受限","flag":"getExpressInfo->daylimit"
}
解决方法:
1)授权接口已超出当前接口产品请求的最大限制;
2)请根据实际使用需求升级您的接口产品。
{"result":0,"description":"请求受限","flag":"getExpressInfoNoSmart->daylimit"
}
解决方法:
1)授权接口已超出当前接口产品请求的最大限制;
2)请根据实际使用需求升级您的接口产品。
快递查询(快递单号智能识别/快递公司+快递单号)-完整提供 Demo 代码示例及数据专业且全面的 API 查询接口相关推荐
- POS 商户编号查询-完整提供 Demo 代码示例及数据专业且全面的 API 查询接口
更多资料请参考:www.woyaocha.net/product/posmcc 接口描述 功能描述 通过商户编号获取中国大陆地区所有线下收单机构的商户信息,如:收单机构.MCC编码类别.适用费率及商户 ...
- 2019-nCoV肺炎疫情同程查询-完整提供 Demo 代码示例及数据专业且全面的 API 查询接口
更多资料请参考:www.woyaocha.net/product/trip2019ncov 手机查询链接(已开发好的):www.woyaocha.net/trip2019ncov 接口使用 我要查询 ...
- 行政区划代码查询-完整提供 Demo 代码示例及数据专业且全面的 API 查询接口
更多资料请参考:www.woyaocha.net/product/area 接口描述 功能描述 根据行政区划代码获取行政区划名称,或者根据行政区划名称获取行政区划代码. URL 示例 1)http 协 ...
- 手机号码查询-整提供 Demo 代码示例及数据专业且全面的 API 查询接口
更多资料请参考:www.woyaocha.net/product/mobile 接口描述 功能描述 获取手机号码段的省市区以及运营商名称,通俗的说就是获取手机号码的归属地及电信运营商名称. URL 示 ...
- 院校代码/高等学校查询-整提供 Demo 代码示例及数据专业且全面的 API 查询接口
更多资料请参考:www.woyaocha.net/product/school 接口描述 功能描述 通过院校名称获取院校对应的院校代码/高等学校,或者通过院校代码/高等学校获取对应的院校名称:后期将会 ...
- Interview:算法岗位面试—11.06早上上海某智能驾驶科技公司(创业)笔试+面试之手撕代码、项目考察、比赛考察、图像算法的考察等
Interview:算法岗位面试-11.06早上上海某智能驾驶科技公司(创业)笔试+面试之手撕代码.项目考察.比赛考察.图像算法的考察等 导读:该公司是在同济某次大型招聘会上投的,当时和HR聊了半个多 ...
- 单例模式代码_设计模式之单例:程序员必知必会,举例子+代码示例,通俗易懂...
推荐学习 给力!啃烂这套"核心知识"+"高级面试",成功定级腾讯JavaT4 举个通俗的例子:我们电脑桌面上的一些软件快捷方式,我们可以创建多个这样的快捷方式, ...
- 快递100企业版物流快递查询接口(API) 接口文档-详细加长版
快递100物流查询接口现已支持1200家常用的快递及物流公司单号查询.快递网点电话查询.快递价格查询.快递网上寄件服务.近期快递100物流查询接口推出针对部分B2C商城以及移动手机应用需要快递单号查询 ...
- Matlab:基于Matlab通过GUI实现自动驾驶的车牌智能识别
Matlab:基于Matlab通过GUI实现自动驾驶的车牌智能识别 目录 车牌图像数据集 视频动态演示 核心代码 相关文章 Matlab:基于Matlab通过GUI实现自动驾驶的车牌智能识别 Matl ...
最新文章
- 汇总|3D人脸重建算法
- Oracle针对SCOTT下EMP表的练习题
- 使MySQL 支持繁体字
- ANSYS——ANSYS后处理操作技巧与各类问题良心大总结
- java中的string是什么_什么是String
- 万用表怎么测量电池容量_万用表检测光电耦合器的常用技巧
- 蓝桥杯 ALGO31 算法训练 开心的金明 java版
- 实施工程师是干嘛的_CTO大怒:300万建设数据中台,啥也没看见,我要它干嘛?...
- nginx 文件服务器_Nginx必不可少啊!!!
- 防盗链及图片加密系统
- 详解Guitar Pro 7导入吉他谱的步骤
- 一个在线挑选编程字体的网站
- 原型工具axure7.0
- JavaOOP项目 - 嗖嗖移动业务大厅
- matlab huffman树,Huffman树图像加密算法
- 修改elemntui tabs 下划线长短
- 微信小程序常用组件库收藏备用
- Matlab学习笔记(1) - 符号变量及其运算
- SVN服务端和客户端搭建教程
- 上海大学电影学院计算机17,上海大学17级表演系女神集体曝光,有网红也有小明星...
热门文章
- 【尚硅谷】新web项目-QQZone代码及详细解析
- wcp mysql 密码_[wcp部署]Linux(Ubuntu)安装部署WCP
- java鸡兔同笼_java 鸡兔同笼问题
- 关于移动端滚动列表,不发起请求刷新列表的解决思路
- Hbuilder红色版下载
- python日历函数_Python—日历函数—日历模块的常用函数,calendar,常见
- 基于springboot实现注册功能发送激活码至邮箱激活账户登录
- 关于8051汇编语言的keil中出现的A45: UNDEFINED SYMBOL (PASS-2)错误
- 我的世界服务器物品在护甲,我的世界满级护甲指令,我的世界召唤盔甲架指令...
- 为什么蘑菇丁会显示服务器繁忙,浅谈蘑菇丁自动打卡