import com.baidubce.http.ApiExplorerClient; import com.baidubce.http.AppSigner; import com.baidubce.http.HttpMethodName; import com.baidubce.model.ApiExplorerRequest; import com.baidubce.model.ApiExplorerResponse; // 快递公司名称和简码类型 Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "http://gwgp-vutahqmpegu.n.bdcloudapi.com/getExpressList"; ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.GET, path); request.setCredentials("您的 access key", "您的 secret key"); request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8"); request.addQueryParameter("type", ""); ApiExplorerClient client = new ApiExplorerClient(new AppSigner()); try { ApiExplorerResponse response = client.sendRequest(request); // 返回结果格式为Json字符串 System.out.println(response.getResult()); } catch (Exception e) { e.printStackTrace(); } } }
点击复制代码
{"status":"200","msg":"success","result":{"ZTO":"中通快递"}}
请求参数说明
参数 | 类型 | 必须 | 示例值 | 描述 |
no | string | 是 | 454244690951 | 运单编号 【顺丰请输入运单号: 收件人或寄件人手机号后四位。例如:123456789:1234】 |
type | string | 否 | zto | 快递公司代码[见附表] 1 可不填 95%能自动识别,填写查询速度会更快 2 自动识别不能100%准确 3 解释:一个单号可对应多个快递公司如:1000745320654,韵达快递,EMS,百世汇通都有该单号记录。 这种单号系统无法准确自动识别。 4 其他注意:中国邮政分家为 邮政包裹【chinapost】 和 邮政速递物流【EMS】,参数EMS是物流,CHINAPOST 才是平时的包裹 |
返回结果说明
字段名 | 类型 | 示例值 | 描述 |
msg | string | ok | 消息 |
result | object | {...} | 结果集 |
issign | string | 1 | 是否本人签收【不准 可能物管帮收】 |
number | string | 454244690951 | 运单编号 |
expName | string | 中通快递 | 快递公司名字 |
deliverystatus | string | 3 | 投递状态 0快递收件(揽件)1.在途中 2.正在派件 3.已签收 4.派送失败 5.疑难件 6.退件签收 |
expSite | string | www.zto.com | 快递公司官网 |
expPhone | string | 95311 | 快递公司电话 |
courier | string | 张三 | 快递员 |
courierPhone | string | 1308110XXXX | 快递员电话 |
updateTime | string | 2019-08-27 13:56:19 | 最新快递物流轨迹的时间 |
takeTime | string | 2天20小时14分 | 发货到收货耗时(截止最新轨迹) |
type | string | zto | 快递公司编码 |
list | array | [...] | 结果集 |
time | string | 2017-09-19 18:01:22 | 时间点 |
status | string | [成都市] [成都华阳]的派件已签收 感谢使用中通快递,期待再次为您服务! | 事件详情 |
快递投递状态码(deliverystatus)
状态码 | 说明 |
0 | 快递收件(揽件) |
1 | 在途中 |
2 | 正在派件 |
3 | 已签收 |
4 | 派送失败(无法联系到收件人或客户要求择日派送,地址不详或手机号不清) |
5 | 疑难件(收件人拒绝签收,地址有误或不能送达派送区域,收费等原因无法正常派送) |
6 | 退件签收 |
status外层返回状态码
状态码 | 说明 |
0 | 查询正常 |
201 | 快递单号错误 |
203 | 快递公司不存在 |
204 | 快递公司识别失败 |
205 | 没有信息;单号错误 (一个单号对应多个快递公司,请求须指定快递公司) |
207 | 该单号被限制,错误单号;一个单号对应多个快递公司,请求须指定快递公司 |