查询地址快递是否可以送达
可以前置查询接口,查询地址快递是否可以送达 ,一次可以查询50个地址。
1.请求参数:
请求URL:
公共参数
参数名称 | 参数类型 | 是否必须 | 示例值 | 参数描述 |
---|---|---|---|---|
appid | String | 是 | 合作伙伴AppId | |
timestamp | String | 是 | 1657525936 | 当前Unix时间戳,秒 |
seller_nick | String | 是 | oms38173182 | 抖店的账号,对应蜂巢授权返回doudianseller字段 |
sign | String | 是 |
业务参数
参数名称 | 参数类型 | 是否必须 | 示例值 | 参数描述 |
---|---|---|---|---|
request_data | json | 见下面的示例json | 业务参数 |
request_data的报文格式
{
"logistics_code": "zhongtong", // 快递公司代码
"addr_list": [ //最多50个地址
{
"object_id": "id001", // 自定义传入,蜂巢会原样返回,用于标识不同的地址。
"sender_addr": { //发件地址信息
"country_code": "CHN", //中国代码
"city_name": "杭州市", // 市
"detail_address": "龙湖西溪天街蓝海引擎8楼",// 详细地址
"district_name": "西湖区", // 区
"province_name": "浙江省",// 省
"street_name": "" //街道名称,可以为空
},
"receiver_addr": { // 收件地址信息
"country_code": "CHN",//中国代码
"city_name": "金华市", // 市
"detail_address": "福田街道紫金一区35栋3单元店面", // 详细地址, 支持密文传入
"district_name": "义乌市", // 区
"province_name": "浙江省", // 省
"street_name": "" //街道名称,可以为空
}
},
{
"object_id": "id002",
"sender_addr": {
"country_code": "CHN",
"city_name": "杭州市",
"detail_address": "龙湖西溪天街蓝海引擎8楼",
"district_name": "西湖区",
"province_name": "浙江省",
"street_name": ""
},
"receiver_addr": {
"country_code": "CHN",
"city_name": "象山县",
"detail_address": "天安路999号",// 详细地址, 支持密文传入
"district_name": "宁波市",
"province_name": "浙江省",
"street_name": ""
}
}
],
"type": 0, //类型(0-揽派合一;1-揽收区域;2-派送区域) 0:取senderAddress, receiverAddress值 1:取senderAddress值 2:取receiverAddress值
"service_list": [], //增值服务 目前只支持德邦
"product_type": "", // 产品类型 目前只支持德邦
"delivery_req": {} //投递要求 目前只支持德邦
}
2. 请求示例代码(Java)
@Test
public void DDLogisticsGetOutRange() throws Exception {
String requestData = "{" +
" \"logistics_code\": \"zhongtong\"," +
" \"addr_list\": [" +
" {" +
" \"object_id\": \"id001\"," +
" \"sender_addr\": {" +
" \"country_code\": \"CHN\"," +
" \"city_name\": \"杭州市\"," +
" \"detail_address\": \"龙湖西溪天街蓝海引擎8楼\"," +
" \"district_name\": \"西湖区\"," +
" \"province_name\": \"浙江省\"," +
" \"street_name\": \"\"" +
" }," +
" \"receiver_addr\": {" +
" \"country_code\": \"CHN\"," +
" \"city_name\": \"金华市\"," +
" \"detail_address\": \"福田街道紫金一区35栋3单元店面\"," +
" \"district_name\": \"义乌市\"," +
" \"province_name\": \"浙江省\"," +
" \"street_name\": \"\"" +
" }" +
" }," +
" {" +
" \"object_id\": \"id002\"," +
" \"sender_addr\": {" +
" \"country_code\": \"CHN\"," +
" \"city_name\": \"杭州市\"," +
" \"detail_address\": \"龙湖西溪天街蓝海引擎8楼\"," +
" \"district_name\": \"西湖区\"," +
" \"province_name\": \"浙江省\"," +
" \"street_name\": \"\"" +
" }," +
" \"receiver_addr\": {" +
" \"country_code\": \"CHN\"," +
" \"city_name\": \"象山县\"," +
" \"detail_address\": \"天安路999号\"," +
" \"district_name\": \"宁波市\"," +
" \"province_name\": \"浙江省\"," +
" \"street_name\": \"\"" +
" }" +
" }" +
"" +
" ]," +
" \"type\": 0," +
" \"service_list\": []," +
" \"product_type\": \"\"," +
" \"delivery_req\": {}" +
"}";
Map<String, Object> data = new HashMap<String, Object>();
data.put("appid", Config.AppId);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
data.put("seller_nick", Config.DDSellerNick);
data.put("request_data", requestData);
data.put("sign", Sign(data, Config.AppSecret));
// 调用服务API
String resp = doHttpRequest(Config.DDLogisticsGetOutRangeUrl, data);
System.out.println(resp);
}
3. 返回结果如下:
{
{
"code": 0,
"message": "ok",
"data": [
{
"object_id": "id001", // 自定义传入,蜂巢会原样返回,用于标识不同的地址。
"is_out_range": true, // 是否超区响应结果(超区-true;未超区-fasle)
"out_range_reason": "疫情管控", // 超区原因
"code": 0, // 成功为0
"msg": "" // 非0时,有失败的原因。
},
{
"object_id": "id002",// 自定义传入,蜂巢会原样返回,用于标识不同的地址。
"is_out_range": false, // 是否超区响应结果(超区-true;未超区-fasle)
"out_range_reason": "",// 超区原因
"code": 0, // 成功为0
"msg": "" // 非0时,有失败的原因。
}
]
}
文档更新时间: 2024-09-24 11:26 作者:admin