天气时光机

平台: API iOS Android

获取最近10天的天气历史再分析数据。

例如今天是12月30日,最多可获取12月20日至12月29日的天气历史数据。

和风天气额外提供了2000年至今的历史再分析气象数据,通过数据文件的形式发送,如需要长时间的历史气象数据数据,请提供下列信息,发送邮件至sales@qweather.com,我们将有专人与你联系:

  • 企业名称
  • 联系方式
  • 所需要的城市或坐标
  • 所需要的时间范围

请求URL

https://api.qweather.com/v7/historical/weather?{查询参数}

请求参数

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

  • location(必选)需要查询的地区,仅支持LocationID,LocationID可通过GeoAPI获取。例如 location=101010100
  • date(必选)选择日期,最多可选择最近10天(不包含今天)的数据。日期格式为yyyyMMdd,例如 date=20200531
  • key(必选)用户认证key,请参考如何获取你的KEY。支持数字签名方式进行认证。例如 key=123456789ABC
  • lang多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。
  • unit数据单位设置,可选值包括unit=m(公制单位,默认)和unit=i(英制单位)。更多选项和说明参考度量衡单位

请求示例

北京天气历史数据,替换date=20200725为最近10天的日期。

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

返回数据

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

{
  "code": "200",
  "fxLink": "http://hfx.link/2ax6",
  "weatherDaily": {
    "date": "2020-07-25",
    "sunrise": "05:08",
    "sunset": "19:33",
    "moonrise": "09:54",
    "moonset": "22:40",
    "moonPhase": "峨眉月",
    "tempMax": "33",
    "tempMin": "23",
    "humidity": "52",
    "precip": "0.0",
    "pressure": "1000"
  },
  "weatherHourly": [
    {
      "time": "2020-07-25 00:00",
      "temp": "28",
      "icon": "100",
      "text": "晴",
      "precip": "0.0",
      "wind360": "246",
      "windDir": "西南风",
      "windScale": "2",
      "windSpeed": "8",
      "humidity": "49",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 01:00",
      "temp": "27",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "350",
      "windDir": "北风",
      "windScale": "1",
      "windSpeed": "4",
      "humidity": "57",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 02:00",
      "temp": "25",
      "icon": "100",
      "text": "晴",
      "precip": "0.0",
      "wind360": "175",
      "windDir": "南风",
      "windScale": "2",
      "windSpeed": "7",
      "humidity": "63",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 03:00",
      "temp": "25",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "359",
      "windDir": "北风",
      "windScale": "1",
      "windSpeed": "5",
      "humidity": "68",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 04:00",
      "temp": "23",
      "icon": "100",
      "text": "晴",
      "precip": "0.0",
      "wind360": "126",
      "windDir": "东南风",
      "windScale": "1",
      "windSpeed": "3",
      "humidity": "73",
      "pressure": "1000"
    },
    {
      "time": "2020-07-25 05:00",
      "temp": "23",
      "icon": "100",
      "text": "晴",
      "precip": "0.0",
      "wind360": "166",
      "windDir": "东南风",
      "windScale": "1",
      "windSpeed": "4",
      "humidity": "76",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 06:00",
      "temp": "23",
      "icon": "100",
      "text": "晴",
      "precip": "0.0",
      "wind360": "69",
      "windDir": "东北风",
      "windScale": "1",
      "windSpeed": "2",
      "humidity": "75",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 07:00",
      "temp": "26",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "358",
      "windDir": "北风",
      "windScale": "1",
      "windSpeed": "4",
      "humidity": "71",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 08:00",
      "temp": "28",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "189",
      "windDir": "南风",
      "windScale": "1",
      "windSpeed": "3",
      "humidity": "57",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 09:00",
      "temp": "30",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "350",
      "windDir": "北风",
      "windScale": "1",
      "windSpeed": "3",
      "humidity": "48",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 10:00",
      "temp": "32",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "180",
      "windDir": "南风",
      "windScale": "1",
      "windSpeed": "2",
      "humidity": "48",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 11:00",
      "temp": "33",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "177",
      "windDir": "南风",
      "windScale": "2",
      "windSpeed": "6",
      "humidity": "40",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 12:00",
      "temp": "32",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "222",
      "windDir": "西南风",
      "windScale": "2",
      "windSpeed": "10",
      "humidity": "39",
      "pressure": "1001"
    },
    {
      "time": "2020-07-25 13:00",
      "temp": "32",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "187",
      "windDir": "南风",
      "windScale": "2",
      "windSpeed": "10",
      "humidity": "40",
      "pressure": "1000"
    },
    {
      "time": "2020-07-25 14:00",
      "temp": "33",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "266",
      "windDir": "西风",
      "windScale": "2",
      "windSpeed": "9",
      "humidity": "36",
      "pressure": "1000"
    },
    {
      "time": "2020-07-25 15:00",
      "temp": "32",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "183",
      "windDir": "南风",
      "windScale": "1",
      "windSpeed": "2",
      "humidity": "39",
      "pressure": "1000"
    },
    {
      "time": "2020-07-25 16:00",
      "temp": "32",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "189",
      "windDir": "南风",
      "windScale": "1",
      "windSpeed": "4",
      "humidity": "39",
      "pressure": "999"
    },
    {
      "time": "2020-07-25 17:00",
      "temp": "32",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "173",
      "windDir": "南风",
      "windScale": "1",
      "windSpeed": "5",
      "humidity": "42",
      "pressure": "999"
    },
    {
      "time": "2020-07-25 18:00",
      "temp": "32",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "173",
      "windDir": "南风",
      "windScale": "2",
      "windSpeed": "9",
      "humidity": "39",
      "pressure": "999"
    },
    {
      "time": "2020-07-25 19:00",
      "temp": "31",
      "icon": "101",
      "text": "多云",
      "precip": "0.0",
      "wind360": "185",
      "windDir": "南风",
      "windScale": "1",
      "windSpeed": "4",
      "humidity": "46",
      "pressure": "999"
    },
    {
      "time": "2020-07-25 20:00",
      "temp": "30",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "185",
      "windDir": "南风",
      "windScale": "2",
      "windSpeed": "8",
      "humidity": "44",
      "pressure": "999"
    },
    {
      "time": "2020-07-25 21:00",
      "temp": "29",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "208",
      "windDir": "西南风",
      "windScale": "2",
      "windSpeed": "7",
      "humidity": "52",
      "pressure": "1000"
    },
    {
      "time": "2020-07-25 22:00",
      "temp": "29",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "188",
      "windDir": "南风",
      "windScale": "2",
      "windSpeed": "7",
      "humidity": "57",
      "pressure": "1000"
    },
    {
      "time": "2020-07-25 23:00",
      "temp": "28",
      "icon": "104",
      "text": "阴",
      "precip": "0.0",
      "wind360": "180",
      "windDir": "南风",
      "windScale": "1",
      "windSpeed": "5",
      "humidity": "61",
      "pressure": "1000"
    }
  ],
  "refer": {
    "sources": [
      "QWeather"
    ],
    "license": [
      "QWeather Developers License"
    ]
  }
}
  • code 请参考状态码
  • fxLink 当前数据的响应式页面,便于嵌入网站或应用
  • weatherDaily.date 当天日期
  • weatherDaily.sunrise 当天日出时间在高纬度地区可能为空
  • weatherDaily.sunset 日落时间在高纬度地区可能为空
  • weatherDaily.moonrise 当天月升时间可能为空
  • weatherDaily.moonset 当天月落时间可能为空
  • weatherDaily.moonPhase 当天月相名称
  • weatherDaily.tempMax 当天最高温度
  • weatherDaily.tempMin 当天最低温度
  • weatherDaily.precip 当天总降水量,默认单位:毫米
  • weatherDaily.pressure 大气压强,默认单位:百帕
  • weatherDaily.humidity 当天每小时相对湿度,百分比数值
  • weatherHourly.time 当天时间
  • weatherHourly.temp 当天每小时温度,默认单位:摄氏度
  • weatherHourly.icon 当天每小时天气状况的图标代码,另请参考天气图标项目
  • weatherHourly.text 当天每小时天气状况的文字描述,包括阴晴雨雪等天气状态的描述
  • weatherHourly.wind360 当天每小时风向360角度
  • weatherHourly.windDir 当天每小时风向
  • weatherHourly.windScale 当天每小时风力等级
  • weatherHourly.windSpeed 当天每小时风速,公里/小时
  • weatherHourly.humidity 当天每小时相对湿度,百分比数值
  • weatherHourly.precip 当天每小时累计降水量,默认单位:毫米
  • weatherHourly.pressure 大气压强,默认单位:百帕
  • refer.sources 原始数据来源,或数据源说明,可能为空
  • refer.license 数据许可或版权声明,可能为空