## 航班信息查询 ![](https://img.kancloud.cn/77/b9/77b9db389c533db68b83ba592eb402ef_171x165.png) > 航班实时、历史起降时间查询 ## 接口费用( [点击购买](https://market.topthink.com/product/326)) > 最低 0.15元/次 ## 接口调用([调用须知](https://docs.topthink.com/think-api/1835086)) ## 接口1:实时起降信息查询 当日航班,方式1:可通过出发城市和到达城市三字码查询起降信息;方式2:通过指定航班号查询起降信息 ### 请求地址 ``` GET https://api.topthink.com/flight/query ``` ### 请求参数 | 名称 | 必填 | 类型 | 说明 | | --- | --- | --- | --- | | appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | orgCity | 是 | string | 始发城市的三字码(方式1必传) | | dstCity | 是 | string | 到达城市的三字码(方式1必传) | | flightNo | 是 | string | 航班号 (方式2必传) | ### 返回`data`参数 | 名称 | 类型 | 说明 | | --- | --- | --- | | FlightNo | 字符串 | 航班号 | | Rate | 字符串 | 准点率 | | DepCity | 字符串 | 出发城市名称 | | DepCode | 字符串 | 出发港口三字码 | | ArrCity | 字符串 | 到达城市名称 | | ArrCode | 字符串 | 到达港口三字码 | | DepTerminal | 字符串 | 出发港口航站楼 | | ArrTerminal | 字符串 | 到达港口航站楼 | | DepScheduled | 时间类型 | 计划起飞时间 | | ArrScheduled | 时间类型 | 计划到达时间 | | DepEstimated | 时间类型 | 预计起飞时间 | | ArrEstimated | 时间类型 | 预计到达时间 | | DepActual | 时间类型 | 实际起飞时间 | | ArrActual | 时间类型 | 实际到达时间 | | FlightState | 字符串 | 航班状态,计划/起飞/延误/到达/备降/取消 | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->flightQuery() ->withOrgCity('PEK') ->withDstCity('WUH') ->request(); dump($result); ``` 返回示例 ``` { "code": 0, "message": "成功", "data":[ { "FlightNo": "CZ9378", "Rate": "92.00", "DepCity": "北京首都", "DepCode": "PEK", "ArrCity": "武汉天河", "ArrCode": "WUH", "DepTerminal": "T2", "ArrTerminal": "T2", "DepScheduled": "2014-12-19T08:05:00", "ArrScheduled": "2014-12-19T10:15:00", "DepEstimated": "2014-12-19T08:23:00", "ArrEstimated": "2014-12-19T09:40:00", "DepActual": "2014-12-19T08:23:00", "ArrActual": "2014-12-19T10:09:00", "FlightState": "到达", "arrRate": "93" }, { "FlightNo": "MU2460", "Rate": "92.00", "DepCity": "北京首都", "DepCode": "PEK", "ArrCity": "武汉天河", "ArrCode": "WUH", "DepTerminal": "T2", "ArrTerminal": "T2", "DepScheduled": "2014-12-19T08:05:00", "ArrScheduled": "2014-12-19T10:15:00", "DepEstimated": "2014-12-19T08:05:00", "ArrEstimated": "2014-12-19T10:15:00", "DepActual": "2014-12-19T08:23:00", "ArrActual": "2014-12-19T10:09:00", "FlightState": "到达", "arrRate": "90.67" }, { "FlightNo": "MU3185", "Rate": "92.00", "DepCity": "北京首都", "DepCode": "PEK", "ArrCity": "武汉天河", "ArrCode": "WUH", "DepTerminal": "T2", "ArrTerminal": "T2", "DepScheduled": "2014-12-19T08:35:00", "ArrScheduled": "2014-12-19T10:45:00", "DepEstimated": "2014-12-19T08:51:00", "ArrEstimated": "2014-12-19T10:48:00", "DepActual": "2014-12-19T08:51:00", "ArrActual": "2014-12-19T10:38:00", "FlightState": "到达", "arrRate": "89.33" }, { "FlightNo": "MF4777", "Rate": "92.00", "DepCity": "北京首都", "DepCode": "PEK", "ArrCity": "武汉天河", "ArrCode": "WUH", "DepTerminal": "T2", "ArrTerminal": "T2", "DepScheduled": "2014-12-19T08:35:00", "ArrScheduled": "2014-12-19T10:45:00", "DepEstimated": "2014-12-19T08:51:00", "ArrEstimated": "2014-12-19T10:48:00", "DepActual": "2014-12-19T08:51:00", "ArrActual": "2014-12-19T10:38:00", "FlightState": "到达", "arrRate": "89.67" }, { "FlightNo": "CZ6605", "Rate": "95.00", "DepCity": "北京首都", "DepCode": "PEK", "ArrCity": "武汉天河", "ArrCode": "WUH", "DepTerminal": "T2", "ArrTerminal": "T2", "DepScheduled": "2014-12-19T08:35:00", "ArrScheduled": "2014-12-19T10:45:00", "DepEstimated": "2014-12-19T08:30:00", "ArrEstimated": "2014-12-19T10:38:00", "DepActual": "2014-12-19T08:51:00", "ArrActual": "2014-12-19T10:38:00", "FlightState": "到达", "arrRate": "90" } ] } ``` ## 接口2:历史起降信息查询 ### 请求地址 ``` GET https://api.topthink.com/flight/history ``` ### 请求参数 | 名称 | 必填 | 类型 | 说明 | | --- | --- | --- | --- | | appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | flightNo | 是 | string | 航班号 | | flightDate | 是 | Date | (年月日) | ### 返回`data`参数 | 名称 | 类型 | 说明 | | --- | --- | --- | | FlightNo | 字符串 | 航班号 | | Rate | 字符串 | 准点率 | | DepCity | 字符串 | 出发城市名称 | | DepCode | 字符串 | 出发港口三字码 | | ArrCity | 字符串 | 到达城市名称 | | ArrCode | 字符串 | 到达港口三字码 | | DepTerminal | 字符串 | 出发港口航站楼 | | ArrTerminal | 字符串 | 到达港口航站楼 | | DepScheduled | 时间类型 | 计划起飞时间 | | ArrScheduled | 时间类型 | 计划到达时间 | | DepEstimated | 时间类型 | 预计起飞时间 | | ArrEstimated | 时间类型 | 预计到达时间 | | DepActual | 时间类型 | 实际起飞时间 | | ArrActual | 时间类型 | 实际到达时间 | | FlightState | 字符串 | 航班状态 | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->flightHistory() ->withFlightNo('MF4777') ->withFlightDate('2014-12-10') ->request(); dump($result); ``` 返回结果示例: ``` { "code": 0, "message": "成功", "data": { "FlightNo": "MF4777", "Rate": "0", "DepCity": "北京首都", "DepCode": "PEK", "ArrCity": "武汉天河", "ArrCode": "WUH", "DepPort": "北京首都", "ArrPort": "武汉天河", "DepTerminal": "T2", "ArrTerminal": "T2", "DepScheduled": "2014-12-10T08:35:00", "ArrScheduled": "2014-12-10T10:45:00", "DepEstimated": "2014-12-10T11:00:00", "ArrEstimated": "2014-12-10T13:08:00", "DepActual": "2014-12-10T11:21:00", "ArrActual": "2014-12-10T13:06:00", "FlightState": "到达", "Delay_Time": "0", "arrRate": "89" } } ``` ## 接口3:根据航班号日期查询未来航班信息 ### 请求地址 ``` GET https://api.topthink.com/flight/future ``` ### 请求参数 | 名称 | 必填 | 类型 | 说明 | | --- | --- | --- | --- | | appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | flightNo | 是 | string | 航班号 | | flightDate | 否 | string | 航班日期,默认明天 | ### 返回`data`参数 | 名称 | 类型 | 说明 | | --- | --- | --- | | FlightNo | 字符串 | 航班号 | | DepCity | 字符串 | 出发城市名称 | | DepCode | 字符串 | 出发港口三字码 | | ArrCity | 字符串 | 到达城市名称 | | ArrCode | 字符串 | 到达港口三字码 | | DepTerminal | 字符串 | 出发港口航站楼 | | ArrTerminal | 字符串 | 到达港口航站楼 | | DepScheduled | 时间类型 | 计划起飞时间 | | ArrScheduled | 时间类型 | 计划到达时间 | | DepEstimated | 时间类型 | 预计起飞时间 | | ArrEstimated | 时间类型 | 预计到达时间 | | DepActual | 时间类型 | 实际起飞时间 | | ArrActual | 时间类型 | 实际到达时间 | | FlightState | 字符串 | 航班状态,未来航班均为 计划 | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->flightFuture() ->withFlightNo('MF4777') ->withFlightDate('2019-04-02') ->request(); dump($result); ``` 返回结果示例: ``` { "code": 0, "message": "成功", "data":{ "FlightNo": "MU4682", "DepCity": "北京", "DepCode": "PEK", "ArrCity": "上海", "ArrCode": "SHA", "DepTerminal": "T3", "ArrTerminal": "T2", "DepScheduled": "2019-04-02T06:50:00", "ArrScheduled": "2019-04-02T09:05:00", "DepEstimated": "2019-04-02T06:50:00", "ArrEstimated": "2019-04-02T09:05:00", "DepActual": "0001-01-01T00:00:00", "ArrActual": "0001-01-01T00:00:00", "PlaneStyle": "321", "FlightState": "计划", "arrRate": [], "arrRate_attr": { "xsi:nil": "true" } } } ```