跳转到内容
返回官网

订单结果查询

因Internet环境下,网络不是绝对可靠,用户系统下订单到顺丰后,不一定可以收到顺丰系统返回的数据,此接口用于在未收到返回数据时,查询订单创建接口客户订单当前的处理情况。

一、请求参数

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

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

一(一)、参数request_data 的说明

#属性名类型(约束)必填默认值描述
1orderIdString(64)客户订单号
2searchTypeString(1)1查询类型:1.正向单查询,传入的orderId为正向订单号,2.退货单查询,传入的orderId为退货原始订单号
3languageString(100)语言(返回描述语)

二、请求示例代码

Java

/**
* 查询订单
* @throws Exception
*/
@Test
public void searchOrder() throws Exception {
String result ="";
String jsonData = "{" +
"\"searchType\": \"1\"," +
"\"orderId\": \"QIAO-20200618-200\"," +
"\"language\": \"zh-cn\"" +
"}";
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost( Config.SFExpressSearchOrderUrl );
//业务参数
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": "00017A8938302C3FE343DA12DF34623F",
"apiResultCode": "A1000",
"apiResultData": "{\"success\":true,\"errorCode\":\"S0000\",\"errorMsg\":null,\"msgData\":{\"orderId\":\"QIAO-20200618-200\",\"returnExtraInfoList\":null,\"waybillNoInfoList\":[{\"waybillType\":1,\"waybillNo\":\"SF1303262056675\"}],\"origincode\":\"719\",\"destcode\":\"710\",\"filterResult\":\"2\",\"remark\":null,\"routeLabelInfo\":[{\"code\":\"1000\",\"routeLabelData\":{\"waybillNo\":\"SF1303262056675\",\"sourceTransferCode\":\"\",\"sourceCityCode\":\"719\",\"sourceDeptCode\":\"719\",\"sourceTeamCode\":\"\",\"destCityCode\":\"710\",\"destDeptCode\":\"710BF\",\"destDeptCodeMapping\":\"\",\"destTeamCode\":\"001\",\"destTeamCodeMapping\":\"\",\"destTransferCode\":\"710VA\",\"destRouteLabel\":\"710BF-001\",\"proName\":\"顺丰标快\",\"cargoTypeCode\":\"T6\",\"limitTypeCode\":\"T6\",\"expressTypeCode\":\"B1\",\"codingMapping\":\"\",\"codingMappingOut\":\"\",\"xbFlag\":\"0\",\"printFlag\":\"000000000\",\"twoDimensionCode\":\"MMM={'k1':'710VA','k2':'710BF','k3':'001','k4':'T6','k5':'SF1303262056675','k6':'','k7':'46ff3389'}\",\"proCode\":\"T6\",\"printIcon\":\"00000000\",\"abFlag\":\"\",\"destPortCode\":\"\",\"destCountry\":\"\",\"destPostCode\":\"\",\"goodsValueTotal\":\"\",\"currencySymbol\":\"\",\"cusBatch\":\"\",\"goodsNumber\":\"\",\"errMsg\":\"\",\"checkCode\":\"46ff3389\",\"proIcon\":\"\",\"fileIcon\":\"\",\"fbaIcon\":\"\",\"icsmIcon\":\"\",\"destGisDeptCode\":\"710BF\",\"newIcon\":null,\"sendAreaCode\":null,\"destinationStationCode\":null,\"sxLabelDestCode\":null,\"sxDestTransferCode\":null,\"sxCompany\":null,\"newAbFlag\":null,\"destAddrKeyWord\":null,\"rongType\":null},\"message\":\"SF1303262056675:\"}]}}"
},
"trace_id": "KgcSQcVUzdOpXxhtMgLz"
}

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

四、返回参数msgData说明

#属性名类型(约束)必填默认值描述
1orderIdString(64)客户订单号
2destCodeString(30)目的地区域代码,可用于顺丰电子运单标签打印
3filterResultString(30)筛单结果:1:人工确认2:可收派3:不可以收派
4returnExtraInfoListList返回信息扩展属性
5waybillNoInfoListList顺丰运单号
6routeLabelInfoList路由标签数据

四(一)、元素 returnExtraInfoList/List

#属性名类型(约束)必填描述
1attrNameString(30)扩展属性名
2attrValString(30)扩展属性值

四(二)、元素 waybillNoInfoList/List

#属性名类型(约束)必填描述
1waybillTypeString(30)运单号类型1:母单 2 :子单 3 : 签回单
2waybillNoString(30)运单号

四(三)、元素 routeLabelInfo/List

#属性名类型(约束)必填描述
1codeString(30)0000(接口参数异常)0010(其它异常)0001(xml解析异常)0002(字段校验异常)0003(票数节点超出最大值,批量请求最大票数为100票)0004(RLS获取路由标签的必要字段为空)1000 成功
2messageString(30)系统错误信息(系统异常后就不会有路由标签业务处理)
3routeLabelDataRouteLabelRespDetailDto路由标签数据对象

四(四)、元素 routeLabelInfo/List/routeLabelData/RouteLabelRespDetailDto

#属性名类型(约束)必填描述
1waybillNoString(30)运单号
2sourceTransferCodeString(60)原寄地中转场
3sourceCityCodeString(60)原寄地城市代码
4sourceDeptCodeString(60)原寄地网点代码
5sourceTeamCodeString(60)原寄地单元区域
6destCityCodeString(60)目的地城市代码,eg:755
7destDeptCodeString(60)目的地网点代码,eg:755AQ
8destDeptCodeMappingString(60)目的地网点代码映射码
9destTeamCodeString(60)目的地单元区域,eg:001
10destTeamCodeMappingString(60)目的地单元区域映射码
11destTransferCodeString(60)目的地中转场
12destRouteLabelString(200)打单时的路由标签信息如果是大网的路由标签,这里的值是目的地网点代码,如果是同城配的路由标签,这里的值是根据同城配的设置映射出来的值,不同的配置结果会不一样,不能根据-符号切分(如:上海同城配,可能是:集散点-目的地网点-接驳点,也有可能是目的地网点代码-集散点-接驳点)
131proNameString(600)产品名称
14twoDimensionCodeString(30)二维码根据规则生成字符串信息,* 格式为MMM={‘k1’:’(目的地中转场代码)’,* ‘k2’:’(目的地原始网点代码)’,* ‘k3’:’(目的地单元区域)’,* ‘k4’:’(附件通过三维码(express_type_code、limit_type_code、cargo_type_code)映射时效类型)’,* ‘k5’:’(运单号)’}
15proCodeString(30)时效类型
16printIconString(20)打印图标* 根据托寄物判断需要打印的图标(锂电池,蟹类,生鲜,易碎)* 返回值有4位,每一位只有0和1两种,0表示按运单默认的规则,1表示显示* 顺序如下:锂电池,蟹类,生鲜,易碎* 如:0000表示不需要打印锂电池,蟹类,生鲜 ,易碎
17abFlagString(600)AB标
18destPortCodeString(30)目的地口岸代码
19destCountryString(100)目的国别(国别代码如:JP)
20destPostCodeString(30)目的地邮编
21goodsValueTotalString(1000)总价值(保留两位小数,数字类型)
22currencySymbolString(100)币种
23goodsNumberString(100)件数
24proIconString(100)