预估快递到达时间!全新升级!快递时效明细查询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 | 目的地。例如:北京 |
com | string | true | 快递公司编码,对应表格可在产品详情中下载 |
orderTime | string | false | 下单时间。默认为当前时间,格式为:2020-09-12 16:45:13 |
curl http://cloud.kuaidi100.com/api -X POST -d \
"secret_key=***&secret_code=81bb0620fbaf460db4e6dab84a05ec00&secret_sign=md5(***)&from=&to=&com=&orderTime="
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", "81bb0620fbaf460db4e6dab84a05ec00");
params.put("secret_sign", "md5(***)");
params.put("from", "");
params.put("to", "");
params.put("com", "");
params.put("orderTime", "");
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=81bb0620fbaf460db4e6dab84a05ec00'.'&';
$params .= 'secret_sign=md5(***)'.'&';
$params .= 'from='.'&';
$params .= 'to='.'&';
$params .= 'com='.'&';
$params .= 'orderTime='.'&';
$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'] = '81bb0620fbaf460db4e6dab84a05ec00'
params['secret_sign'] = 'md5(***)'
params['from'] = ''
params['to'] = ''
params['com'] = ''
params['orderTime'] = ''
result = requests.post('http://cloud.kuaidi100.com/api', params)
print(result.text)
无参数
{
"fromName": "广州",
"fromNum": "CN440100000000",
"toName": "喀什",
"toNum": "CN653101000000",
"orderTime": "2020-10-15 14:03:39",
"returnCode": "200",
"result": true,
"message": "成功",
"totalAvg": "6天23小时",
"mayExpendTime": "7天1小时",
"type": "10",
"arrivalTime": "2020-10-22 15:00:00",
"startTime": "2020-10-15 16:00:00",
"proportionList": [
{
"day": "6天23小时",
"proportion": "78.26%"
}
],
"maxRouteList": [
{
"id": null,
"name": "揽收",
"indexLevel": null,
"mayStartTime": "16",
"type": 0,
"hourAvge": "0",
"cid": "CN440112000000"
},
{
"id": "CN440112000000",
"name": "广东,广州市,黄埔区",
"indexLevel": "3",
"mayStartTime": "18",
"type": 2,
"hourAvge": "1",
"cid": "CN650100000000"
},
{
"id": "CN650100000000",
"name": "新疆,乌鲁木齐市",
"indexLevel": "2",
"mayStartTime": "4",
"type": 1,
"hourAvge": "77",
"cid": "CN650107000000"
},
{
"id": "CN650107000000",
"name": "新疆,乌鲁木齐市,达坂城区,阿克苏乡",
"indexLevel": "3",
"mayStartTime": "6",
"type": 1,
"hourAvge": "0",
"cid": "CN652900000000"
},
{
"id": "CN652900000000",
"name": "新疆,阿克苏地区",
"indexLevel": "2",
"mayStartTime": "2",
"type": 2,
"hourAvge": "34",
"cid": "CN653101000000"
},
{
"id": "CN653101000000",
"name": "新疆,喀什地区,喀什市,色满乡",
"indexLevel": "3",
"mayStartTime": "9",
"type": 2,
"hourAvge": "39",
"cid": null
},
{
"id": null,
"name": "派件",
"indexLevel": null,
"mayStartTime": "11",
"type": 3,
"hourAvge": "14",
"cid": null
},
{
"id": null,
"name": "签收",
"indexLevel": null,
"mayStartTime": "11",
"type": 4,
"hourAvge": "2",
"cid": null
}
],
"isRecommend": true, //是否是推荐路线
"recommendFromCode": "CN440309020000", //推荐路线的出发地编码
"recommendToCode": "CN653101000000", //推荐路线的出发地名称
"recommendFromName": "广东,深圳市,龙华区", //推荐路线的目的地编码
"recommendToName": "新疆,喀什地区,喀什市,色满乡" //推荐路线的目的地名称
}
{
"returnCode": "400",
"message": "系统繁忙",
}
状态码 | 状态码信息 | 描述 |
---|---|---|
200 | 成功 |
1、时效明细查询V2:全新升级,推荐使用!可预测快递寄出后的到达时间,精确到小时级
温馨提示:因部分快递公司只提供国内业务或只提供国际业务,部分线路会出现无时效数据的情况。
返回参数说明
属性 | 类型 | 描述 |
returnCode | String | 对应编码 |
message | String | 描述 |
com | String | 快递公司编码 |
fromName | String | 出发地 |
fromNum | String | 编码 |
toName | String | 目的地 |
toNum | String | 编码 |
orderTime | String | 下单时间(yyyy-MM-dd HH:mm:ss) |
totalAvg | String | 平均耗时 |
type | String | 业务类型10:普通,20:快,30:特快 |
arrivalTime | String | 预测到达时间(示例:2020-06-27 04:00:00) |
startTime | String | 预测出发时间(示例:2020-06-27 04:00:00) |
proportionList | list | 天数占比 |
day | String | 天 |
proportion | String | 百分比 |
maxRouteList | list | 路由轨迹 |
id | String | 节点ID |
name | String | 节点名称(行政区名称) |
indexLevel | String | 节点层级 |
mayStartTime | String | 预测当前节点出发时间(比如:8-代表8点出发) |
type | String | 节点类型(0.揽收,1.干线,2普通路径,3.派件,4.签收) |
hourAvge | String | 节点耗时 |
cid | String | 下一节点编码 |
2、时效明细查询:
通过出发地、目的地、下单时间和快递公司,预测下单后到达时间,并返回相关明细。
返回参数说明:
属性 | 类型 | 描述 |
result | Boolean | 判断结果是否成功 |
returnCode | String | 对应编码 |
message | String | 描述 |
com | String | 快递公司编码 |
fromName | String | 出发地 |
fromNum | String | 编码 |
toName | String | 目的地 |
toNum | String | 编码 |
orderTime | String | 下单时间(yyyy-MM-dd HH:mm:ss) |
totalAvg | String | 平均耗时 |
type | String | 业务类型10:普通,20:快,30:特快 |
arrivalTime | String | 预测下单后到达时间(yyyy-MM-dd a) |
proportionList | list | 天数占比 |
day | String | 天 |
proportion | String | 百分比 |
maxRouteList | list | 路由轨迹 |
id | String | 节点ID |
name | String | 节点名称(行政区名称) |
indexLevel | String | 节点层级 |
cid | String | 子节点ID |
type | String | 节点类型(0.揽收,1.干线,2普通路径,3.派件,4.签收) |
hourAvge | String | 节点耗时 |
天数占比
百分比:该天数所占的百分比。
参数中的快递公司请使用该表对应的编码
快递公司编码表:
快递公司编码 | 快递公司名称 |
shunfeng | 顺丰速运 |
tiantian | 天天快递 |
zhongtong | 中通快递 |
shentong | 申通快递 |
ems | EMS |
yunda | 韵达快递 |
yuantong | 圆通速递 |
huitongkuaidi | 百世快递 |
zhaijisong | 宅急送 |
youshuwuliu | 优速快递 |
debangkuaidi | 德邦 |
suer | 速尔快递 |
youzhengguonei | 邮政快递包裹 |
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 | 恒路物流 |