历史天气

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

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

我们还提供2010年至今的中国历史天气数据,请与我们联系

请求URL #

https://datasetapi.qweather.com/v7/historical/weather?[请求参数]

请求参数 #

请求参数包括必选和可选参数,如不填写可选参数将使用其默认值,参数之间使用&进行分隔。

location

需要查询的地区,仅支持LocationID,LocationID可通过城市搜索服务获取。例如 location=101010100

date

选择日期,最多可选择最近10天(不包含今天)的数据。日期格式为yyyyMMdd,例如 date=20200531

key

用户认证key,请参考如何获取你的KEY。支持数字签名方式进行认证。例如 key=123456789ABC

lang

多语言设置,默认中文,当数据不匹配你设置的语言时,将返回英文或其本地语言结果。

unit

度量衡单位参数选择,例如温度选摄氏度或华氏度、公里或英里。默认公制单位

  • m 公制单位,默认
  • i 英制单位

返回数据 #

// 北京天气历史数据 
// 商业版 https://api.qweather.com/v7/historical/weather?location=101010100&date=20200725&key=你的KEY
// 请将示例中的date更换成最近10天的日期

{
  "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.com"
    ],
    "license": [
      "commercial license"
    ]
  }
}
参数 描述
code

API状态码,具体含义请参考状态码

fxLink

当前数据的响应式页面,便于嵌入网站或应用

weatherDaily.date

当天日期

weatherDaily.sunrise

当天日出时间

weatherDaily.sunset

当天日落时间

weatherDaily.moonrise

当天月升时间

weatherDaily.moonset

当天月落时间

weatherDaily.moonPhase

当天月相名称

weatherDaily.tempMax

当天最高温度

weatherDaily.tempMin

当天最低温度

weatherDaily.precip

当天总降水量,默认单位:毫米

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

数据许可或版权声明,可能为空