每日天气预报

平台: API iOS Android

每日天气预报API,提供全球城市未来3-30天天气预报,包括:日出日落、月升月落、最高最低温度、天气白天和夜间状况、风力、风速、风向、相对湿度、大气压强、降水量、露点温度、紫外线强度、能见度等。

请求URL

3天预报
https://api.qweather.com/v7/weather/3d?{查询参数}
7天预报
https://api.qweather.com/v7/weather/7d?{查询参数}
10天预报
https://api.qweather.com/v7/weather/10d?{查询参数}
15天预报
https://api.qweather.com/v7/weather/15d?{查询参数}
30天预报
https://api.qweather.com/v7/weather/30d?{查询参数}

如果是免费订阅,将上述API Host更改为devapi.qweather.com。参考免费订阅可用的数据

请求参数

请求参数包括必选和可选参数,参数之间使用&进行分隔。

  • key(必选)用户认证key,请参考如何获取你的KEY。支持数字签名方式进行认证。例如 key=123456789ABC
  • location(必选)需要查询地区的LocationID或以英文逗号分隔的经度,纬度坐标(十进制,最多支持小数点后两位),LocationID可通过GeoAPI获取。例如 location=101010100location=116.41,39.92
  • lang多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。
  • unit数据单位设置,可选值包括unit=m(公制单位,默认)和unit=i(英制单位)。更多选项和说明参考度量衡单位

请求示例

curl -L -X GET --compressed 'https://api.qweather.com/v7/weather/3d?location=101010100&key=YOUR_KEY'

返回数据

返回数据是JSON格式并进行了Gzip压缩

{
  "code": "200",
  "updateTime": "2021-11-15T16:35+08:00",
  "fxLink": "http://hfx.link/2ax1",
  "daily": [
    {
      "fxDate": "2021-11-15",
      "sunrise": "06:58",
      "sunset": "16:59",
      "moonrise": "15:16",
      "moonset": "03:40",
      "moonPhase": "盈凸月",
      "moonPhaseIcon": "803",
      "tempMax": "12",
      "tempMin": "-1",
      "iconDay": "101",
      "textDay": "多云",
      "iconNight": "150",
      "textNight": "晴",
      "wind360Day": "45",
      "windDirDay": "东北风",
      "windScaleDay": "1-2",
      "windSpeedDay": "3",
      "wind360Night": "0",
      "windDirNight": "北风",
      "windScaleNight": "1-2",
      "windSpeedNight": "3",
      "humidity": "65",
      "precip": "0.0",
      "pressure": "1020",
      "vis": "25",
      "cloud": "4",
      "uvIndex": "3"
    },
    {
      "fxDate": "2021-11-16",
      "sunrise": "07:00",
      "sunset": "16:58",
      "moonrise": "15:38",
      "moonset": "04:40",
      "moonPhase": "盈凸月",
      "moonPhaseIcon": "803",
      "tempMax": "13",
      "tempMin": "0",
      "iconDay": "100",
      "textDay": "晴",
      "iconNight": "101",
      "textNight": "多云",
      "wind360Day": "225",
      "windDirDay": "西南风",
      "windScaleDay": "1-2",
      "windSpeedDay": "3",
      "wind360Night": "225",
      "windDirNight": "西南风",
      "windScaleNight": "1-2",
      "windSpeedNight": "3",
      "humidity": "74",
      "precip": "0.0",
      "pressure": "1016",
      "vis": "25",
      "cloud": "1",
      "uvIndex": "3"
    },
    {
      "fxDate": "2021-11-17",
      "sunrise": "07:01",
      "sunset": "16:57",
      "moonrise": "16:01",
      "moonset": "05:41",
      "moonPhase": "盈凸月",
      "moonPhaseIcon": "803",
      "tempMax": "13",
      "tempMin": "0",
      "iconDay": "100",
      "textDay": "晴",
      "iconNight": "150",
      "textNight": "晴",
      "wind360Day": "225",
      "windDirDay": "西南风",
      "windScaleDay": "1-2",
      "windSpeedDay": "3",
      "wind360Night": "225",
      "windDirNight": "西南风",
      "windScaleNight": "1-2",
      "windSpeedNight": "3",
      "humidity": "56",
      "precip": "0.0",
      "pressure": "1009",
      "vis": "25",
      "cloud": "0",
      "uvIndex": "3"
    }
  ],
  "refer": {
    "sources": [
      "QWeather",
      "NMC",
      "ECMWF"
    ],
    "license": [
      "QWeather Developers License"
    ]
  }
}
  • code 请参考状态码
  • updateTime 当前API的最近更新时间
  • fxLink 当前数据的响应式页面,便于嵌入网站或应用
  • daily.fxDate 预报日期
  • daily.sunrise 日出时间在高纬度地区可能为空
  • daily.sunset 日落时间在高纬度地区可能为空
  • daily.moonrise 当天月升时间可能为空
  • daily.moonset 当天月落时间可能为空
  • daily.moonPhase 月相名称
  • daily.moonPhaseIcon 月相图标代码,另请参考天气图标项目
  • daily.tempMax 预报当天最高温度
  • daily.tempMin 预报当天最低温度
  • daily.iconDay 预报白天天气状况的图标代码,另请参考天气图标项目
  • daily.textDay 预报白天天气状况文字描述,包括阴晴雨雪等天气状态的描述
  • daily.iconNight 预报夜间天气状况的图标代码,另请参考天气图标项目
  • daily.textNight 预报晚间天气状况文字描述,包括阴晴雨雪等天气状态的描述
  • daily.wind360Day 预报白天风向360角度
  • daily.windDirDay 预报白天风向
  • daily.windScaleDay 预报白天风力等级
  • daily.windSpeedDay 预报白天风速,公里/小时
  • daily.wind360Night 预报夜间风向360角度
  • daily.windDirNight 预报夜间当天风向
  • daily.windScaleNight 预报夜间风力等级
  • daily.windSpeedNight 预报夜间风速,公里/小时
  • daily.precip 预报当天总降水量,默认单位:毫米
  • daily.uvIndex 紫外线强度指数
  • daily.humidity 相对湿度,百分比数值
  • daily.pressure 大气压强,默认单位:百帕
  • daily.vis 能见度,默认单位:公里
  • daily.cloud 云量,百分比数值。可能为空
  • refer.sources 原始数据来源,或数据源说明,可能为空
  • refer.license 数据许可或版权声明,可能为空