产品详情
API参数 快递时效查询 调用地址: http,https://kuaidi100time.api.bdymkt.com/api 请求方式: GET 支持格式: application/x-www-form-urlencoded 调用工具: 去调试 请求参数(Headers) 请求参数(Query)
- 名称
- 类型
- 是否必须
- 示例值
- 描述
- from
- string
- false
- 广东深圳
- 始发地
- to
- string
- false
- 北京
- 目的地
- orderTime
- string
- false
- 2021-03-31 16:45:13
- 寄件时间
<dependency>
<groupId>com.baidubce</groupId>
<artifactId>api-explorer-sdk</artifactId>
<version>1.0.0</version>
</dependency>
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://kuaidi100time.api.bdymkt.com/api";
ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.GET, path);
request.setCredentials("您的 access key", "您的 secret key");
request.addHeaderParameter("Content-Type", "application/x-www-form-urlencoded");
request.addQueryParameter("from", "");
request.addQueryParameter("to", "");
request.addQueryParameter("orderTime", "");
String requestExample = "from=广东深圳&to=北京&orderTime=2021-03-30 16:00:10";
request.setJsonBody(requestExample);
ApiExplorerClient client = new ApiExplorerClient(new AppSigner());
try {
ApiExplorerResponse response = client.sendRequest(request);
// 返回结果格式为Json字符串
System.out.println(response.getResult());
} catch (Exception e) {
e.printStackTrace();
}
}
}
点击复制代码
正常返回示例 { "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": "系统繁忙", }
错误码定义 - code
- message
- status
- 描述
- 200
- 成功
- 200
- 成功
- 400
- 系统繁忙
- 400
- 系统繁忙
