API开通即用版本 1.0.578387708

航空天气

按 ICAO 机场代码查询最近的 METAR 实况报文,可选附带 TAF 机场预报。数据来自美国 NOAA 航空天气中心,不可用于飞行计划或导航。

不依赖你自己的任何账号,在组织中开通后即可调用。

商品介绍

按 ICAO 机场代码查询最近的 METAR 实况报文,可选附带 TAF 机场预报。数据来自美国 NOAA 航空天气中心,不可用于飞行计划或导航。 ## 数据源 请求中的 `provider` 从以下数据源中选择: - `awc` (us) ## 调用与计费 - 调用 ID(`invocation_id`)由市场网关写入,请求中无需携带,携带的值会被替换。 - 只有服务返回执行成功(`data.execution.outcome` 为 `succeeded`)的调用按一次请求计费;参数错误、数据源失败和结果未知的调用不计费。 - 服务在 `data.execution.usage.units` 中报告用量,单位为 `reports`。

价格

免费

  • 按请求:免费

按实际用量计费,开通本身不收费。调用成功后才计量。

以上为公开标价。你的组织可能有协议价,以控制台显示的价格为准。

档位

档位
zgiservices · standard
档位标识
zgi-aviation-weather-standard
接口协议
HTTP 接口

如何使用

  1. 为组织开通

    在控制台为组织开通此商品。开通后即可调用,不需要你自己的厂商账号。

  2. 创建凭证

    在控制台“凭证”中创建一个凭证。密钥只显示一次,请保存到环境变量 ZGI_MARKET_KEY,并在每次请求中携带:

    Authorization: Bearer $ZGI_MARKET_KEY

    也可以使用 X-API-Key 请求头。一份凭证可以调用组织已开通的所有商品。

  3. 调用网关

    沿用厂商原有的请求与响应格式,只需把 Base URL 和密钥换成下面的值。

    Base URL
    https://market-api.zgi.im/v1/gateway/zgi-aviation-weather-standard
    请求示例
    curl -X POST "https://market-api.zgi.im/v1/gateway/zgi-aviation-weather-standard/v1/aviation-weather-queries" \
      -H "Authorization: Bearer $ZGI_MARKET_KEY" \
      -H "Content-Type: application/json" \
      -d '{}'

    入参与输出

    各操作的入参和输出结构,以 JSON Schema 描述。

    POST /v1/aviation-weather-queries

    入参 Schema
    {
      "type": "object",
      "required": [
        "provider",
        "stations"
      ],
      "properties": {
        "provider": {
          "enum": [
            "awc"
          ],
          "type": "string",
          "description": "Provider that serves the request; choose by the coverage described for this tool."
        },
        "stations": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "1-10 four-character ICAO station codes, for example KJFK or EGLL."
        },
        "include_taf": {
          "type": "boolean",
          "description": "Also return each station's terminal aerodrome forecast (TAF); default false."
        },
        "hours_before": {
          "type": "integer",
          "description": "Hours of past METAR observations to return, 1-24; default 2."
        }
      },
      "additionalProperties": false
    }
    输出 Schema
    {
      "type": "object",
      "required": [
        "code",
        "data"
      ],
      "properties": {
        "code": {
          "type": "integer"
        },
        "data": {
          "type": "object",
          "required": [
            "execution",
            "result"
          ],
          "properties": {
            "result": {
              "type": "object",
              "required": [
                "stations",
                "unknown_stations",
                "disclaimer",
                "source"
              ],
              "properties": {
                "source": {
                  "type": "object",
                  "required": [
                    "name",
                    "license",
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "license": {
                      "type": "string"
                    }
                  }
                },
                "stations": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "object",
                    "required": [
                      "icao",
                      "name",
                      "latitude",
                      "longitude",
                      "metars",
                      "taf"
                    ],
                    "properties": {
                      "taf": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "required": [
                          "raw",
                          "issued_at",
                          "valid_from",
                          "valid_to"
                        ],
                        "properties": {
                          "raw": {
                            "type": "string"
                          },
                          "valid_to": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "issued_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "valid_from": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      },
                      "icao": {
                        "type": "string"
                      },
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "metars": {
                        "type": [
                          "array",
                          "null"
                        ],
                        "items": {
                          "type": "object",
                          "required": [
                            "raw",
                            "observed_at",
                            "temperature_c",
                            "dewpoint_c",
                            "wind_direction_deg",
                            "wind_variable",
                            "wind_speed_kt",
                            "wind_gust_kt",
                            "visibility",
                            "altimeter_hpa",
                            "flight_category"
                          ],
                          "properties": {
                            "raw": {
                              "type": "string"
                            },
                            "dewpoint_c": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "visibility": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "observed_at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "wind_gust_kt": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "altimeter_hpa": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "temperature_c": {
                              "type": [
                                "number",
                                "null"
                              ]
                            },
                            "wind_speed_kt": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "wind_variable": {
                              "type": "boolean"
                            },
                            "flight_category": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "wind_direction_deg": {
                              "type": [
                                "integer",
                                "null"
                              ]
                            }
                          }
                        }
                      },
                      "latitude": {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      "longitude": {
                        "type": [
                          "number",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "disclaimer": {
                  "type": "string"
                },
                "unknown_stations": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  }
                }
              }
            },
            "execution": {
              "type": "object",
              "description": "The recorded execution: id, invocation_id, outcome, usage, and timing."
            }
          }
        },
        "message": {
          "type": "string"
        }
      }
    }

来源与审核

审核状态
未记录
许可证
未说明

审核状态是平台对上架信息的记录,不构成对上游服务质量或可用性的担保。