调用地址
无需鉴权
支持 CORS
每 IP 每分钟 60 次;结果缓存 300 秒
在线调试
请求会发送到本站接口当前请求:https://api.blueworkshop.top/api/v1/weather
请求参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
latitude必填 |
number | - | 纬度,例如北京为 39.9。 示例: 39.9 |
longitude必填 |
number | - | 经度,例如北京为 116.4。 示例: 116.4 |
forecast_days |
int | 1 |
预报天数,1 到 7。 示例: 1 |
请求示例
cURL
curl "https://api.blueworkshop.top/api/v1/weather?latitude=39.9&longitude=116.4&forecast_days=1"
JavaScript
const res = await fetch("https://api.blueworkshop.top/api/v1/weather?latitude=39.9&longitude=116.4&forecast_days=1");
const data = await res.json();
console.log(data);响应示例
{
"ok": true,
"data": {
"latitude": 39.89455,
"longitude": 116.35983,
"timezone": "Asia/Shanghai",
"current": {
"time": "2026-10-24T10:00",
"temperature_2m": 15.6,
"relative_humidity_2m": 48,
"apparent_temperature": 14.2,
"weather_code": 1,
"wind_speed_10m": 2.3
},
"daily": {
"time": [
"2026-10-24"
],
"temperature_2m_max": [
18.4
],
"temperature_2m_min": [
8.1
],
"weather_code": [
1
]
}
},
"meta": {
"endpoint": "weather",
"cached": false
}
}
成功时返回 JSON 信封:ok 表示是否成功,data 为数据,meta.cached 表示是否命中本站缓存。图片类接口直接返回二进制图片。
错误响应
| HTTP | 错误码 | 说明 |
|---|---|---|
| 400 | missing_param / invalid_param | 缺少参数或参数格式不正确,响应会带上出错参数名。 |
| 404 | not_found | 接口不存在,或上游没有找到对应资源。 |
| 405 | method_not_allowed | 请求方法与接口要求不一致。 |
| 429 | rate_limited | 请求过于频繁,响应头 Retry-After 给出建议等待秒数。 |
| 502 | upstream_error / upstream_rate_limited | 上游服务异常或触发限流。 |
| 504 | timeout | 上游请求超时。 |
接口说明
Open-Meteo 是免费开放的气象数据服务,无需密钥。本接口按经纬度返回当前温度、湿度、体感温度、天气代码与风速,并可返回逐日最高最低温。
返回的 weather_code 为 WMO 天气代码,例如 0 表示晴、61 表示小雨。商业用途请遵守 Open-Meteo 的许可条款。