预估快递到达时间!全新升级!时效查询V2版本,可预测快递寄出后的到达时间,精确到小时级。
无参数
无参数
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
secret_key | string | true | 用户授权key |
secret_code | string | true | 接口编号 |
secret_sign | string | true | 加密签名:md5(secret_key+secret_secret)转大写 |
from | string | true | 出发地。例如:广东深圳 |
to | string | true | 目的地。例如:北京 |
orderTime | string | true | 下单时间。默认为当前时间,格式为:2020-09-12 16:45:13 |
companyList | string | false | 快递公司列表。选填,传入该参数后,只会返回对应快递公司的时效。例如:huitongkuaidi,tiantian,zhaijisong,zhongtong,shentong,yunda,jd,yuantong |
curl http://cloud.kuaidi100.com/api -X POST -d \
"secret_key=***&secret_code=4cdfccdf64ea4088a94eb2ea1ef40c97&secret_sign=md5(***)&from=&to=&orderTime=&companyList="
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
public class CloudDemo {
public static void main (String[] args) {
CloudDemo cloudDemo = new CloudDemo();
Map params = new HashMap();
params.put("secret_key", "***");
params.put("secret_code", "4cdfccdf64ea4088a94eb2ea1ef40c97");
params.put("secret_sign", "md5(***)");
params.put("from", "");
params.put("to", "");
params.put("orderTime", "");
params.put("companyList", "");
cloudDemo.post(params);
}
public String post(Map params) {
StringBuilder response = new StringBuilder("");
BufferedReader reader = null;
try {
StringBuilder builder = new StringBuilder();
for (Map.Entry param : params.entrySet()) {
if (builder.length() > 0) {
builder.append('&');
}
builder.append(URLEncoder.encode(param.getKey(), "UTF-8"));
builder.append('=');
builder.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8"));
}
byte[] bytes = builder.toString().getBytes("UTF-8");
URL url = new URL("http://cloud.kuaidi100.com/api");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.setRequestMethod("POST");
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(bytes.length));
conn.setDoOutput(true);
conn.getOutputStream().write(bytes);
reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line = "";
while ((line = reader.readLine()) != null) {
response.append(line);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != reader) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return response.toString();
}
}
class MD5Utils { private static MessageDigest mdigest = null;
private static char digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
private static MessageDigest getMdInst() {
if (null == mdigest) {
try {
mdigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
return mdigest;
}
public static String encode(String s) {
if(null == s) {
return "";
}
try { byte[] bytes = s.getBytes();
getMdInst().update(bytes);
byte[] md = getMdInst().digest();
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for(int i = 0; i < j; i++) {
byte byte0 = md[i];
str[k++] = digits[byte0 >>> 4 & 0xf];
str[k++] = digits[byte0 & 0xf];
}
return new String(str);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
暂无示例
<?php
$params = "";
$params .= 'secret_key=***'.'&';
$params .= 'secret_code=4cdfccdf64ea4088a94eb2ea1ef40c97'.'&';
$params .= 'secret_sign=md5(***)'.'&';
$params .= 'from='.'&';
$params .= 'to='.'&';
$params .= 'orderTime='.'&';
$params .= 'companyList='.'&';
$params .= substr($params, 0, -1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, 'http://cloud.kuaidi100.com/api');
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo $result;
?>
# coding = utf-8
import sys,os
import requests,json,hashlib
params = {}
params['secret_key'] = '***'
params['secret_code'] = '4cdfccdf64ea4088a94eb2ea1ef40c97'
params['secret_sign'] = 'md5(***)'
params['from'] = ''
params['to'] = ''
params['orderTime'] = ''
params['companyList'] = ''
result = requests.post('http://cloud.kuaidi100.com/api', params)
print(result.text)
无参数
{
"returnCode": "200",
"message": "成功",
"data": [
{
"com": "shunfeng",
"totalAvg": "1天4小时",
"type": "10",
"arrivalTime": "2020-07-05 06:00:00",
"startTime": "2020-07-04 2:00:00",
"mayExpendTime": "1天13小时"
},
{
"com": "yunda",
"totalAvg": "1天23小时",
"type": "10",
"arrivalTime": "2020-07-05 21:00:00",
"startTime": "2020-07-03 22:00:00",
"mayExpendTime": "2天4小时"
}
],
"fromName": "南山区",
"fromNum": "CN440305000000",
"toName": "南宁",
"toNum": "CN450100000000",
"orderTime": "2020-07-03 17:24:05"
}
{
"returnCode": "400",
"message": "系统繁忙",
}
状态码 | 状态码信息 | 描述 |
---|---|---|
200 | 成功 | |
10003 | 缺少必填参数 | |
10004 | 该线路暂无时效数据/地址解析异常 | 请确认地址无误 |
-1 | 系统繁忙,请稍候再试 |
通过出发地、目的地、下单时间,可预测快递寄出后的到达时间,精确到小时级。
温馨提示:因部分快递公司只提供国内业务或只提供国际业务,部分线路会出现无时效数据的情况。
升级说明:
推荐使用时效查询V2,精确到小时;
已接入旧版本的用户,可通过修改参数使用时效查询V2版本,无需重复购买。
返回参数说明:
名称 |
类型 |
必填 |
默认值 |
returnCode |
string |
true |
状态码 |
message |
string |
true |
详细信息 |
data |
array[object] |
true |
|
com |
string |
true |
快递公司 |
weigth |
string |
true |
平均耗时 |
type |
string |
true |
快递类型 |
arrivalTime |
string |
true |
预测到达时间 |
startTime |
string |
true |
预测出发时间 |
mayExpendTime |
string |
true |
预测花费时间 |
fromName |
string |
true |
出发点 |
fromNum |
string |
true |
出发点编码 |
toName |
string |
true |
目的地 |
toNum |
string |
true |
目的地编码 |
orderTime |
string |
true |
下单时间 |
参数中的快递公司请使用该表对应的编码
快递公司编码表:
快递公司编码 | 快递公司名称 |
shunfeng | 顺丰速运 |
tiantian | 天天快递 |
zhongtong | 中通快递 |
shentong | 申通快递 |
ems | EMS |
yunda | 韵达快递 |
yuantong | 圆通速递 |
huitongkuaidi | 百世快递 |
zhaijisong | 宅急送 |
youshuwuliu | 优速快递 |
debangkuaidi | 德邦 |
suer | 速尔快递 |
youzhengguonei | 邮政快递包裹 |
jtexpress | 极兔速递 |
ewe | EWE全球快递 |
quanyikuaidi | 全一快递 |
minghangkuaidi | 民航快递 |
pjbest | 品骏快递 |
zhimakaimen | 芝麻开门 |
ztky | 中铁快运 |
lianbangkuaidi | 联邦快递 |
yuanchengwuliu | 远成物流 |
tiandihuayu | 天地华宇 |
rufengda | 如风达 |
longbanwuliu | 龙邦速递 |
youzhengguoji | 国际包裹 |
quanfengkuaidi | 全峰快递 |
jd | 京东物流 |
guotongkuaidi | 国通快递 |
kuaijiesudi | 快捷速递 |
annengwuliu | 安能快运 |
dhlen | DHL-全球件 |
ups | UPS |
usps | USPS |
fedex | FedEx-国际件 |
dhl | DHL-中国件 |
wanxiangwuliu | 万象物流 |
jinguangsudikuaijian | 京广速递 |
yuxinwuliu | 宇鑫物流 |
tnt | TNT |
emsguoji | EMS-国际件 |
cnpex | CNPEX中邮快递 |
zengyisudi | 增益速递 |
zyzoom | 增速跨境 |
bcwelt | BCWELT |
jiayunmeiwuliu | 加运美 |
auexpress | 澳邮中国快运 |
euasia | 欧亚专线 |
rrs | 日日顺物流 |
aolau | AOL澳通速递 |
flyway | 程光快递 |
yuanchengwuliu | 远成物流 |
xlobo | Xlobo贝海国际 |
shipgce | 飞洋快递 |
gdkd | 港快速递 |
hengluwuliu | 恒路物流 |