跳转到内容
返回官网

订单收派范围查询

客户系统通过此接口向顺丰系统发送主动的筛单请求,用于判断客户的收、派地址是否属于顺丰的收派范围。

一、请求参数

POST https://kf.fw199.com/gateway/sfexpress/order/filter

参数名类型说明示例
appidString合作伙伴AppIduwkahf@jfs92
timestampString当前时间戳
request_dataStringjson格式的业务参数见下表1.1
client_codeString顺丰的客户编码
check_wordString顺丰的校验码
signString接口签名如何计算生成见示例代码

一(一)、参数request_data 的说明

#属性名类型(约束)必填默认值描述
1filterTypeNumber(1)1筛单类别:1:自动筛单(系统根据地址库进行判断,并返回结果,系统无法检索到可派送的将返回不可派送)2:可人工筛单(系统首先根据地址库判断,如果无法自动判断是否收派,系统将生成需要人工判断的任务,后续由人工处理,处理结束后,顺丰可主动推送给客户系统)
2orderIdString客户订单号
3monthlyCardString月结卡号
4contactInfosList地址信息(详细参看下2.4.2.2)

一(二)、元素 contactInfos/FilterAddrInfoDto

#属性名类型(约束)必填默认值描述
1contactTypeInteger地址类型 1:寄件方 2:到件方
2telString联系电话
3countryString国家或地区代码 2位
4provinceString省级行政区名称
5cityString地级行政区名称
6countyString县/区级行政区名称
7addressString详细地址
8postCodeString条件邮编,跨境件必填

二、请求示例代码

Java

/**
* 订单筛选接口
* @throws Exception
*/
@Test
public void filterOrder() throws Exception {
String result ="";
// dealType:2表示取消
String jsonData = "[{" +
"\"contactInfos\": [{" +
"\"address\": \"浙江省深圳市南山区粤海街道创智天地大厦B栋27楼南区\"," +
"\"city\": \"深圳市\"," +
"\"contactType\": 1," +
"\"country\": \"中国\"," +
"\"county\": \"\"," +
"\"province\": \"广东省\"," +
"\"tel\": \"4001118851\"" +
"}, {" +
"\"address\": \"南朗镇翠亨村101\"," +
"\"city\": \"中山市\"," +
"\"contactType\": 2," +
"\"country\": \"中国\"," +
"\"county\": \"\"," +
"\"province\": \"广东省\"," +
"\"tel\": \"15888888111\"" +
"}]," +
"\"filterType\": 1 " +
"}]";
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost( Config.SFExpressFilterOrderUrl );
//业务参数
Map<String, String> data = new HashMap<String, String>();
data.put("appid", Config.AppId);
data.put("request_data", jsonData);
data.put("client_code", Config.SFClientCode);
data.put("check_word", Config.SFCheckWord);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
// 参数签名
data.put("sign", Utils.Sign(data,Config.AppSecret));
List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
for (Map.Entry<String, String> entry : data.entrySet()) {
params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
//发起POST请求
try {
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse httpResponse = httpclient.execute(httpPost);
if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
result = EntityUtils.toString(httpResponse.getEntity());
} else {
result = ("doPost Error Response: " + httpResponse.getStatusLine().toString());
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(result);
}

三、返回结果

{
"code": 0,
"message": "ok",
"data": {
"apiErrorMsg": "",
"apiResponseID": "00017A8A1737A83FED7F51BD7733F13F",
"apiResultCode": "A1000",
"apiResultData": "{\"success\":true,\"errorCode\":\"S0000\",\"errorMsg\":null,\"msgData\":[{\"orderId\":null,\"filterResult\":2,\"originCode\":\"755\",\"destCode\":\"760\",\"remark\":null}]}"
},
"trace_id": "SoSQonmPoFRCkHAgi98V"
}

说明: code为0表示成功,非0为失败,message会包含失败原因。

四、元素 OrderFilterResponse

#属性名类型(约束)必填默认值描述
1successboolean返回状态 true/false
2errorCodeInteger条件错误代码
3errorMsgString条件错误详细信息
4msgDataObject条件如果success为true,这个字段代表筛单结果;Success为false时,此字段为空

四(一)、返回参数msgData说明

#属性名类型(约束)必填默认值描述
1orderIdboolean客户订单号
2filterResultInteger筛单结果:1:人工确认2:可收派3:不可以收派4 : 地址无法确认当filter_type=1时,不存在1值
3originCodeString条件原寄地区域代码,如果可收派,此项不能为空
4destCodeString条件目的地区域代码,如果可收派,此项不能为空
5remarkString条件如果filter_result=3时为必填,不可以收派的原因代码:1:收方超范围2:派方超范围3:其它原因