Method: history.hours.lookup

返回指定位置最多 24 小时的每小时历史天气数据,从最后一小时开始。

HTTP 请求

GET https://weather.googleapis.com/v1/history/hours:lookup

网址采用 gRPC 转码语法。

查询参数

参数
location

object (LatLng)

必需。要获取每小时历史数据的位置。

unitsSystem

enum (UnitsSystem)

可选。用于返回天气状况的单位系统。如果未提供,返回的天气状况将采用公制单位(默认 = METRIC)。

pageSize

integer

可选。每页返回的小时历史记录数上限 - 一个介于 1 到 24(含)之间的值。默认值为允许的最大值 24。

pageToken

string

可选。从上一个请求收到的页面令牌。用于检索后续页面。

hours

integer

可选。限制要提取的总小时数(从最后一小时开始)- 从 1 到 24(含)。默认值为允许的最大值 24。

languageCode

string

可选。允许客户端选择回答的语言。如果无法提供相应语言的数据,API 会使用最接近的匹配项。允许的值取决于 IETF BCP-47 标准。默认值为“en”。

请求正文

请求正文必须为空。

响应正文

针对 hours.lookup RPC 的响应。

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
{
  "historyHours": [
    {
      object (HistoryHour)
    }
  ],
  "timeZone": {
    object (TimeZone)
  },
  "nextPageToken": string
}
字段
historyHours[]

object (HistoryHour)

根据请求中指定的小时数和页面大小,每小时的历史记录。

timeZone

object (TimeZone)

所请求位置的时区。

nextPageToken

string

用于检索下一页的令牌。

授权范围

需要以下 OAuth 范围:

  • https://www.googleapis.com/auth/cloud-platform

HistoryHour

表示给定位置的每小时历史记录。

JSON 表示法
{
  "interval": {
    object (Interval)
  },
  "displayDateTime": {
    object (DateTime)
  },
  "weatherCondition": {
    object (WeatherCondition)
  },
  "temperature": {
    object (Temperature)
  },
  "feelsLikeTemperature": {
    object (Temperature)
  },
  "dewPoint": {
    object (Temperature)
  },
  "heatIndex": {
    object (Temperature)
  },
  "windChill": {
    object (Temperature)
  },
  "wetBulbTemperature": {
    object (Temperature)
  },
  "precipitation": {
    object (Precipitation)
  },
  "airPressure": {
    object (AirPressure)
  },
  "wind": {
    object (Wind)
  },
  "visibility": {
    object (Visibility)
  },
  "iceThickness": {
    object (IceThickness)
  },
  "isDaytime": boolean,
  "relativeHumidity": integer,
  "uvIndex": integer,
  "thunderstormProbability": integer,
  "cloudCover": integer
}
字段
interval

object (Interval)

相应历史数据的有效时间区间(以世界协调时间 [UTC] 表示,时间戳会向下舍入到最接近的小时)。

displayDateTime

object (DateTime)

相应位置(民用时间)的时区中计算相应每小时记录的本地日期和时间。此字段可能用于在客户端上显示。注意:此日期将包含年、月、日、小时和与世界协调时间 (UTC) 的偏移量。

weatherCondition

object (WeatherCondition)

历史天气状况。

temperature

object (Temperature)

历史温度。

feelsLikeTemperature

object (Temperature)

所请求位置的体感温度。

dewPoint

object (Temperature)

历史温度。

heatIndex

object (Temperature)

历史酷热指数温度。

windChill

object (Temperature)

历史风寒指数,即暴露在皮肤上的气温。

wetBulbTemperature

object (Temperature)

历史湿球温度,即通过蒸发水可达到的最低温度。

precipitation

object (Precipitation)

过去 1 小时内的历史降水概率和累计降水量。

airPressure

object (AirPressure)

历史气压条件。

wind

object (Wind)

历史风况。

visibility

object (Visibility)

历史可见度。

iceThickness

object (IceThickness)

历史冰厚度。

isDaytime

boolean

如果相应小时介于当地日出时间(含)和日落时间(不含)之间,则返回 True。否则,为夜间(日落和下一次日出之间)。注意:如果相应时间段与当地日出和日落时间分别相交,则此小时将被视为白天或夜晚(例如:如果时间段为上午 5 点至上午 6 点,而日出时间为上午 5:59,则 isDaytime 将为 true)。

relativeHumidity

integer

历史相对湿度百分比(值介于 0 到 100 之间)。

uvIndex

integer

历史紫外线 (UV) 指数。

thunderstormProbability

integer

历史雷暴概率(值介于 0 到 100 之间)。

cloudCover

integer

历史上云层覆盖天空的百分比(值介于 0 到 100 之间)。