簡單的從快遞 100 中獲取快遞信息


快遞查詢

經常有應用需求能根據單號查詢快遞狀態,大多數時候都需求快遞的運輸信息。我們可以從 快遞 100 中快速的獲取到快遞的物流信息。

接口分析

快遞 100 中提供了兩個接口用來結合查詢物流信息:

  • 根據單號智能識別物流方式(順豐、韻達、申通等)
  • 根據單號及物流方式獲取物流信息

智能識別接口

接口地址: http://www.kuaidi100.com/autonumber/autoComNum?text=[單號]
請求方式: GET

接口返回:

成功返回:

{
  "comCode": "",
  "num": "3310479082803",
  "auto": [
    {
    "comCode": "shentong",
    "id": "",
    "noCount": 94165,
    "noPre": "331047",
    "startTime": ""
    }
  ]
}

如果是不能識別的單號那么將返回:

{
  "comCode": "",
  "num": "xxx51017908280",
  "auto": []
}

物流詳情接口

接口地址: http://www.kuaidi100.com/query?type=[comCode]&postid=[單號]&id=1&valicode=&temp=[時間戳]
請求方式: GET

接口返回信息:

{
    "message": "ok",
    "nu": "3310479082803",
    "ischeck": "0",
    "com": "shentong",
    "updatetime": "2016-07-27 13:15:45",
    "status": "200",
    "condition": "00",
    "data": [
        {
            "time": "2016-06-30 03:17:28",
            "location": "",
            "context": "快件已到達 湖北武漢武隆分部",
            "ftime": "2016-06-30 03:17:28"
        },
        {
            "time": "2016-06-29 16:35:02",
            "location": "",
            "context": "由 浙江杭州中轉部 發往 安徽黃山公司",
            "ftime": "2016-06-29 16:35:02"
        },
        {
            "time": "2016-06-29 16:22:00",
            "location": "",
            "context": "由 湖北武漢航空部 發往 湖北武漢武隆分部",
            "ftime": "2016-06-29 16:22:00"
        },
        {
            "time": "2016-06-28 23:09:29",
            "location": "",
            "context": "由 湖北武漢航空部 發往 浙江杭州中轉部",
            "ftime": "2016-06-28 23:09:29"
        },
        {
            "time": "2016-06-28 20:03:09",
            "location": "",
            "context": "由 湖北武漢航空部 發往 浙江杭州中轉部",
            "ftime": "2016-06-28 20:03:09"
        },
        {
            "time": "2016-06-28 20:03:09",
            "location": "",
            "context": "湖北武漢航空部 正在進行 裝袋 掃描",
            "ftime": "2016-06-28 20:03:09"
        },
        {
            "time": "2016-06-28 20:02:52",
            "location": "",
            "context": "由 湖北武漢航空部 發往 浙江杭州中轉部",
            "ftime": "2016-06-28 20:02:52"
        },
        {
            "time": "2016-06-28 19:58:24",
            "location": "",
            "context": "快件已到達 湖北武漢航空部",
            "ftime": "2016-06-28 19:58:24"
        },
        {
            "time": "2016-06-28 17:12:28",
            "location": "",
            "context": "湖北武漢公司(027-83225888) 的收件員 漢口吳燕飛 已收件",
            "ftime": "2016-06-28 17:12:28"
        }
    ],
    "state": "0"
}

異常返回:

{
  "status": "403",
  "message": "快遞公司參數異常:單號格式錯誤"
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM