首页 › API 文档 › 生活查询

天气查询2

查询城市天气信息,返回当前天气、24小时预报、7天预报。输入中文城市名即可查询。

接口地址

GET https://api.tinyaii.cn/v1/weather2

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

请求参数

参数名类型必填说明
citystring是城市名称,如:北京、上海、广州

返回字段

字段名类型说明
citystring查询的城市名
current.weatherstring当前天气状况
current.tempstring当前温度(摄氏度)
current.humiditystring湿度百分比
current.pressurestring气压(百帕)
current.windstring风向风力
current.aqistring空气质量指数
current.aqi_levelstring空气质量等级
forecastarray7天预报列表
forecast[].datestring日期
forecast[].dayobject白天天气
forecast[].nightobject夜间天气
hourlyarray24小时预报列表
hourly[].timestring时间
hourly[].weatherstring天气状况
hourly[].tempstring温度

返回示例

{
  "code": 200,
  "message": "success",
  "data": {
    "city": "北京",
    "current": {
      "weather": "多云",
      "temp": "22",
      "humidity": "66",
      "pressure": "999",
      "wind": "东南风 4-5级",
      "aqi": "45",
      "aqi_level": "优"
    },
    "forecast": [
      {
        "date": "06/13",
        "day": {
          "temp": "29℃",
          "weather": "今天",
          "wind": "西南风 3-4级"
        },
        "night": {
          "temp": "20℃",
          "weather": "雷阵雨",
          "wind": "东风 1-3级"
        }
      }
    ],
    "hourly": [
      {
        "time": "23:00",
        "weather": "多云",
        "temp": "22℃"
      }
    ]
  }
}

调用示例

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

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

相关接口(生活查询)

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