实时天气

获取中国3000+市县区和海外50万个城市实时天气数据,包括实时温度、体感温度、风力风向、相对湿度、大气压强、降水量、能见度、露点温度、云量等。

注意: 实况数据均为近实时数据,相比真实的物理世界有5-20分钟的延迟,请根据实况数据中的obsTime确定数据对应的准确时间。

请求路径#

GET /v7/weather/now

参数#

查询参数

  • location (必选) 需要查询地区的LocationID或以英文逗号分隔的经度,纬度坐标(十进制,最多支持小数点后两位),LocationID可通过GeoAPI获取。例如 location=101010100location=116.41,39.92
  • lang 多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。

请求示例#

curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://your-api-host/v7/weather/now?location=116.41%2C39.92&lang=zh'

请将your_token替换为你的JWT身份认证,将your_api_host替换为你的API Host

试一下

返回数据#

{
  "code": "200",
  "updateTime": "2020-06-30T22:00+08:00",
  "fxLink": "https://www.qweather.com/en/weather/beijing-101010100.html",
  "now": {
    "obsTime": "2020-06-30T21:40+08:00",
    "temp": "24",
    "feelsLike": "26",
    "icon": "101",
    "text": "多云",
    "wind360": "123",
    "windDir": "东南风",
    "windScale": "1",
    "windSpeed": "3",
    "humidity": "72",
    "precip": "0.0",
    "pressure": "1003",
    "vis": "16",
    "cloud": "10",
    "dew": "21"
  },
  "refer": {
    "sources": [
      "https://developer.qweather.com/attribution.html"
    ],
    "license": [
      "QWeather Developers License"
    ]
  }
}
  • code string 状态码
  • updateTime date-time API的最近更新时间
  • fxLink uri 当前数据的响应式页面,便于嵌入网站或应用
  • now object 天气实况数据
    • obsTime date-time 观测时间
    • temp string 温度,默认单位:摄氏度
    • icon string 天气状况的图标代码,另请参考天气图标项目
    • text string 天气状况的文字描述,包括阴晴雨雪等天气状态的描述
    • wind360 string 风向360角度
    • windDir string 风向
    • windScale string 风力等级
    • windSpeed string 风速,公里/小时
    • humidity string 相对湿度,百分比数值
    • precip string 降水量,默认单位:毫米
    • pressure string 站点气压,默认单位:百帕
    • cloud string 云量,百分比数值
    • dew string 露点温度
    • feelsLike string 体感温度,默认单位:摄氏度
    • vis string 能见度,默认单位:公里
  • refer object 数据来源和许可信息
    • sources array 原始数据来源,或数据源说明,可能为空
    • license array 数据许可或版权声明,可能为空