Web/PC

PC端天气网站
桌面浏览器端的天气预报网站,提供未来多小时的详细天气数据展示,包含趋势图表、温湿度等多种可视化内容
forecasts/v1/hourly 逐小时预报:1/12/24 小时标准与 120/240/360 小时进阶,适用于 24h 温降曲线与日程决策,需 Location Key。
华风爱科逐小时预报 API 提供全球地点的逐小时精细化天气预报,分为标准能力与进阶能力。调用前需通过 定位搜索 API 获取 Location Key。与逐日预报按天汇总不同,逐时接口按小时输出,适合 24 小时曲线、出行时段决策等场景。由中国气象局授权品牌与 AccuWeather 全球数据能力提供支撑。
/forecasts/v1/hourly/1hour|12hour|24hour|72hour/{locationkey}.json120hour / 240hour / 360hour 长期逐小时预报(需单独开通)details=true 返回扩展气象要素通过逐小时预报API可以构建的应用示例

桌面浏览器端的天气预报网站,提供未来多小时的详细天气数据展示,包含趋势图表、温湿度等多种可视化内容

原生/混合移动应用,提供贴靠随身浏览的突发天气预防的用户界面

iPad/Android平板优化的天气应用,充分利用大屏幕展示丰富的气象信息

专为车载智能终端优化的气象预报界面,提供实时天气预警与导航辅助
URL 路径格式为 /forecasts/v1/hourly/{Nhour}/{locationkey}.json,其中 {Nhour} 为预报时长(如 12hour),{locationkey} 为定位 API 返回的 Key;下表为查询参数。进阶长期预报仅更换路径中的时长段,查询参数一致。
| 参数名 | 类型 | 必填 | 默认值 | 说明 | 示例 |
|---|---|---|---|---|---|
| apikey | String | 是 | - | 用以在API里验证与授权使用的用户密钥 | YOUR_API_KEY |
| version | String | 是 | v1 | 当前API版本 | v1 |
| locationkey | String | 是 | - | 用以搜索指定地点的特定ID | 101924 |
| language | String | 否 | en-us | 指定响应数据语言的字符串 | zh-cn |
| details | String | 否 | false | 返回完整版的逐时天气预报 | details = true |
| metric | String | 否 | false | 是否使用公制单位 | metric = true |
| 参数 | 类型 | 说明 | 数据形式示例 |
|---|---|---|---|
|
DateTime
|
String | 预报时间(ISO 8601格式) | 2026-07-27T14:00:00+08:00 |
|
EpochDateTime
|
Int | 预报时间的 UNIX 时间戳 | 1785132000 |
|
WeatherIcon
|
Int | 天气图标编号 | 1 |
|
IconPhrase
|
String | 天气状况描述 | 晴 |
|
HasPrecipitation
|
Boolean | 是否有降水 | false |
|
IsDaylight
|
Boolean | 是否为白天 | true |
|
Temperature
▶
|
Object |
温度
3 个子字段
|
- |
|
└─
Value
|
Float | 数值 | 33 |
|
└─
Unit
|
String | 单位 | C |
|
└─
UnitType
|
Int | 单位类型 | 17 |
|
LocalSource
▶
|
Object |
本地数据源信息
6 个子字段
|
- |
|
└─
Id
|
Int | 源 ID | 7 |
|
└─
Name
|
String | 源名称 | Huafeng |
|
└─
WeatherCode
|
String | 天气代码 | 00 |
|
└─
WindLevelCode
|
String | 风力等级代码 | 0 |
|
└─
WindDirectionCode
|
String | 风向代码 | 4 |
|
└─
Pressure
|
Float | 气压 | 1007.83 |
|
PrecipitationProbability
|
Int | 降水概率(%) | 20 |
|
MobileLink
|
String | 移动端链接 | http://m.weathercn.com/zh/cn/beijing/101924/hourly-weather-forecast/101924?day=1&hbhhour=14&u... |
|
Link
|
String | 网页端链接 | http://m.weathercn.com/zh/cn/beijing/101924/hourly-weather-forecast/101924?day=1&hbhhour=14&u... |
curl "https://openapi.weathercn.com/forecasts/v1/hourly/12hour/101924.json?apikey=YOUR_API_KEY&language=zh-cn&details=true"
fetch('https://openapi.weathercn.com/forecasts/v1/hourly/12hour/101924.json?apikey=YOUR_API_KEY&language=zh-cn&details=true')
.then(r => r.json()).then(console.log);
import requests
url = "https://openapi.weathercn.com/forecasts/v1/hourly/12hour/101924.json"
params = {'apikey': 'YOUR_API_KEY', 'language': 'zh-cn', 'details': 'true'}
print(requests.get(url, params=params).json())
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://openapi.weathercn.com/forecasts/v1/hourly/12hour/101924.json?apikey=YOUR_API_KEY&language=zh-cn"))
.build();
<?php
$url = 'https://openapi.weathercn.com/forecasts/v1/hourly/12hour/101924.json';
$params = http_build_query(['apikey'=>'YOUR_API_KEY','language'=>'zh-cn']);
print_r(json_decode(file_get_contents($url.'?'.$params), true));
?>
url := "https://openapi.weathercn.com/forecasts/v1/hourly/12hour/101924.json?apikey=YOUR_API_KEY&language=zh-cn"
resp, _ := http.Get(url)
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
url = URI("https://openapi.weathercn.com/forecasts/v1/hourly/12hour/101924.json")
url.query = URI.encode_www_form({apikey:'YOUR_API_KEY',language:'zh-cn'})
puts JSON.parse(Net::HTTP.get_response(url).body)
let url = URL(string: "https://openapi.weathercn.com/forecasts/v1/hourly/12hour/101924.json?apikey=YOUR_API_KEY&language=zh-cn")!
URLSession.shared.dataTask(with: url) { d,_,_ in if let d=d { print(try? JSONSerialization.jsonObject(with:d)) } }.resume()
[
{
"DateTime": "2026-03-10T11:00:00+08:00",
"EpochDateTime": 1773111600,
"WeatherIcon": 1,
"IconPhrase": "晴",
"HasPrecipitation": false,
"IsDaylight": true,
"Temperature": {
"Value": 6.0,
"Unit": "C",
"UnitType": 17
},
"LocalSource": {
"Id": 7,
"Name": "Huafeng",
"WeatherCode": "00",
"WindLevelCode": "0",
"WindDirectionCode": "1",
"Pressure": 1020.9
},
"PrecipitationProbability": 0,
"MobileLink": "...",
"Link": "..."
},
// ... 中间省略 10 条逐小时预报数据 ...
{
"DateTime": "2026-03-10T22:00:00+08:00",
"EpochDateTime": 1773151200,
"WeatherIcon": 33,
"IconPhrase": "晴",
"HasPrecipitation": false,
"IsDaylight": false,
"Temperature": {
"Value": 6.0,
"Unit": "C",
"UnitType": 17
},
"LocalSource": {
"Id": 7,
"Name": "Huafeng",
"WeatherCode": "00",
"WindLevelCode": "0",
"WindDirectionCode": "4",
"Pressure": 1019.57
},
"PrecipitationProbability": 0,
"MobileLink": "...",
"Link": "..."
}
]
Key。X-Gw-API-Key: YOUR_API_KEY,避免 Key 出现在 URL 日志中。