快递单号识别

根据传入的快递单号判断单号所归属的快递公司;
注意:【由于快递公司单号规则不统一,且不断变化,会存在无法识别的情况,该接口命中率为95-97%左右】

1.请求参数:

请求URL:

POST https://kf.fw199.com/gateway/logistics/num/recognition

参数名称 参数类型 是否必须 示例值 参数描述
appid String 合作伙伴AppId
timestamp String 1657525936 当前Unix时间戳,秒
num String 38173182 要识别的快递单号,支持市场上主流快递公司的单号
sign String

2. 请求示例代码(Java)

 @Test  
public void LogisticsNumRecognition() throws Exception {  

    Map<String, String> data = new HashMap<String, String>();  
    data.put("appid",  Config.AppId);  
    Long timestamp = System.currentTimeMillis() / 1000;  
    data.put("timestamp", timestamp.toString());  
    data.put("num", "9791392354758");  
    // 参数签名  
    data.put("sign", Utils.Sign(data,Config.AppSecret));  
    doHttpRequest(Config.LOGISTICS_NUM_RECOGNITION,data);  
}

3. 返回结果

返回结果如下

{
  "code": 0,
  "message": "ok",
  "data": [
    { "lengthPre": 13, "comCode": "youzhengguonei", "name": "邮政快递包裹" },
    { "lengthPre": 13, "comCode": "ems", "name": "EMS" }
  ],
  "trace_id": ""
} 

返回code为0表示成功, 非0为失败,失败时message会有失败原因。data包括返回的快递公司代码(comCode)和名称(name)。

注意:
由于运单号规则不断变化且各个快递公司没有标准、统一的规则,所以无法保证判断准确率能达到100%。建议在使用时,提示“提示“本结果仅供参考”等文字说明”。

文档更新时间: 2023-11-14 11:59   作者:admin