首页 › API 文档 › 生活查询

天气查询

查询城市当前天气及7天预报,数据源tianqi.com

接口地址

GET, POST https://api.tinyaii.cn/v1/weather

分类:生活查询 · 返回格式:JSON · 鉴权:API Key(URL 参数 apikey 或请求头 Authorization: Bearer)

请求参数

参数名类型必填说明
citystring是城市名称(中文或拼音),如:北京、上海、guangzhou

返回字段

字段名类型说明
data.citystring城市名称
data.current.tempstring当前温度(℃)
data.current.weatherstring天气状况
data.current.temp_lowstring最低温度
data.current.temp_highstring最高温度
data.current.humiditystring湿度(%)
data.current.windstring风向
data.current.wind_levelstring风力等级
data.current.aqistring空气质量
data.current.pm25stringPM2.5
data.current.uvstring紫外线强度
data.current.sunrisestring日出时间
data.current.sunsetstring日落时间
data.forecastarray7天天气预报
data.forecast[].datestring日期
data.forecast[].weekstring星期
data.forecast[].weatherstring天气状况
data.forecast[].temp_lowstring最低温度
data.forecast[].temp_highstring最高温度
data.forecast[].windstring风向
data.forecast[].wind_levelstring风力等级

返回示例

{
  "code": 200,
  "data": {
    "city": "北京",
    "current": {
      "temp": "23",
      "weather": "多云",
      "temp_low": "22",
      "temp_high": "29",
      "humidity": "65",
      "wind": "东北风",
      "wind_level": "1级",
      "aqi": "优",
      "pm25": "11",
      "uv": "很弱",
      "sunrise": "04:48",
      "sunset": "19:47"
    },
    "forecast": [
      {
        "date": "06月30日",
        "week": "星期二",
        "weather": "多云转小雨",
        "temp_low": "21",
        "temp_high": "28",
        "wind": "东北风",
        "wind_level": "1级"
      },
      {
        "date": "07月01日",
        "week": "星期三",
        "weather": "多云转小雨",
        "temp_low": "22",
        "temp_high": "28",
        "wind": "东风",
        "wind_level": "1级"
      }
    ]
  },
  "message": "success"
}

调用示例

curl "https://api.tinyaii.cn/v1/weather?apikey=YOUR_KEY&city=北京"

把 YOUR_KEY 换成你在 用户中心 获取的 API Key,在浏览器打开同样地址也能直接看到结果。

相关接口(生活查询)

本站收录 353 个可免费调用的 API 接口,查看完整开发文档 或 注册获取 API Key。