GET/v1/flights/airports

搜索机场

通过自由文本或附近坐标搜索机场元数据,用于自动补全和基于位置的航班搜索。

分享
GET/v1/flights/airports

API 控制台

试一试

向沙箱 API 发送真实请求并查看响应。

凭证

登录后即可从已保存的 API 密钥中选择,无需手动粘贴。

查询参数

4 个字段

搜索文本

用于匹配机场名称、城市或 IATA 代码的自由文本查询。

纬度

基于半径搜索机场时中心点的纬度。

经度

基于半径搜索机场时中心点的经度。

半径(公里)

围绕所提供坐标的搜索半径(公里)。

cURL 请求

cURL
bash
curl -X GET 'https://api.sandbox.travelandz.com/v1/flights/airports?queryString=Madrid' \
  -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  -H 'X-Travelandz-Id: YOUR_PUBLIC_KEY:YOUR_PROFILE_CODE'

请填写凭证以发送请求。

响应

点击「试一试!」发送请求,响应将显示在此处。

通过自由文本或附近坐标搜索机场元数据,用于自动补全和基于位置的航班搜索。

接口

方法路径认证
GET/v1/flights/airports需要 API key
必需请求头:
Header说明
AuthorizationBearer <secret_key>. The secret is shown only once when the credential is created.
X-Travelandz-Id<public_key>:<profile_code>. The profile_code is the dp_-prefixed Developer Profile code shown in your dashboard. This binds the request to a profile and credential.
Content-TypeUse application/json for requests with a body.

请求参数结构

lat
number
Required when queryString is not provided
lng
number
Required when queryString is not provided
radius
number
Required when queryString is not provided
queryString
string
Alternative to coordinates

请求体

不需要请求体。

成功响应

返回 matching airports and location metadata.

响应体结构

airports
array
airports[]name
string
airports[]city_name
string
airports[]time_zone
string
airports[]longitude
number
airports[]latitude
number
airports[]iata_country_code
string
airports[]iata_code
string
airports[]iata_city_code
string
airports[]type
string
airports[]airportName
string
airports[]distanceFromPoint
number
liveMode
boolean
True when the request is served by the live Travelandz environment. This value comes from Travelandz, not the provider payload.

集成说明

queryString can be used for text search. When using geographic search, send lat, lng and optional radius; radius defaults to 30 kilometers.

Query examples

Text search: ?queryString=Barcelona

Coordinate search: ?lng=2.080877&lat=41.297273&radius=50

示例

bash
bash
curl "https://api.sandbox.travelandz.com/v1/flights/airports?queryString=Madrid" \
  -H "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
  -H "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE"

响应

状态码说明
200Airports retrieved successfully.
400请求无效:payload 不合法。
401未授权:凭证无效或缺失。
403禁止访问:凭证无效。
500服务器内部错误

200 响应体

媒体类型:application/json

json
json
{
  "airports": [
    {
      "name": "Barcelona",
      "city_name": "Barcelona",
      "time_zone": "Europe/Madrid",
      "longitude": 2.080877,
      "latitude": 41.297273,
      "iata_country_code": "ES",
      "iata_code": "BCN",
      "iata_city_code": "BCN",
      "type": "airport",
      "airportName": "Barcelona-El Prat Josep Tarradellas Airport"
    },
    {
      "name": "Barcelona",
      "city_name": "Barcelona",
      "time_zone": "America/Caracas",
      "longitude": -64.684271,
      "latitude": 10.103767,
      "iata_country_code": "VE",
      "iata_code": "BLA",
      "iata_city_code": "BLA",
      "type": "airport",
      "airportName": "General Jose Antonio Anzoategui International Airport"
    }
  ],
  "liveMode": false
}