D DeeAPI API Gateway
DeeAPI
GET 免费 缓存 300s 正常运行

实时天气查询

按经纬度获取当前气温、风速、风向与天气代码,无需申请密钥。

无需鉴权 · 超时 15s
GET https://www.deeapi.com/wp-json/apihub/v1/call/7
i
免费接口:在线调试与程序调用均须填写/携带站点 Key 后使用,不提供匿名试用。Key 在「我的控制台」获取。

接口说明

### 天气代码对照
| code | 含义 |
| — | — |
| 0 | 晴 |
| 1-3 | 多云转阴 |
| 61-67 | 雨 |
| 71-77 | 雪 |

调用统计

0 累计调用
0 今日调用
0% 成功率
0ms 平均耗时

近 30 天调用趋势

10/15 · 010/16 · 010/17 · 010/18 · 010/19 · 010/20 · 010/21 · 010/22 · 010/23 · 010/24 · 010/25 · 010/26 · 010/27 · 010/28 · 010/29 · 010/30 · 010/31 · 011/01 · 011/02 · 011/03 · 011/04 · 011/05 · 011/06 · 011/07 · 011/08 · 011/09 · 011/10 · 011/11 · 011/12 · 011/13 · 0
10/1510/3011/13

请求参数 共 3 个

参数名 必填 默认值 说明
latitude QUERY · number 必填 39.9042 纬度,北京为 39.9042
longitude QUERY · number 必填 116.4074 经度,北京为 116.4074
current_weather QUERY · boolean — true 是否返回当前天气
鉴权参数: 在线调试与程序调用均必须携带站点 Key,以 key 参数传入(Query 或 POST 字段均可),例如 ?key=ah_xxxxxxxx。 Key 在「我的控制台」获取,切勿写进前端代码或提交到公开仓库。

调用示例

BASH
curl -X GET "https://www.deeapi.com/wp-json/apihub/v1/call/7?key=YOUR_SITE_KEY&latitude=39.9042&longitude=116.4074&current_weather=true" \
  -H "Accept: application/json"
PHP
<?php
$url = 'https://www.deeapi.com/wp-json/apihub/v1/call/7?key=YOUR_SITE_KEY&latitude=39.9042&longitude=116.4074&current_weather=true';

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 20,
    CURLOPT_HTTPHEADER     => ['Accept: application/json'],
]);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
print_r($data);
JAVASCRIPT
const params = {"key":"YOUR_SITE_KEY","latitude":"39.9042","longitude":"116.4074","current_weather":"true"};
const url = 'https://www.deeapi.com/wp-json/apihub/v1/call/7?' + new URLSearchParams(params);

const res = await fetch(url, {
  method: 'GET',
  headers: { 'Accept': 'application/json' }
});

const data = await res.json();
console.log(data);
PYTHON
import requests

url = "https://www.deeapi.com/wp-json/apihub/v1/call/7"
params = {
    "key": "YOUR_SITE_KEY",
    "latitude": "39.9042",
    "longitude": "116.4074",
    "current_weather": "true",
}

resp = requests.get(url, params=params, timeout=20)
print(resp.json())

返回示例

网关会统一包装返回结果,业务数据在 data 字段内:

JSON
{
  "ok": true,
  "http_code": 200,
  "cost_ms": 186,
  "credits": 0,
  "currency": "points",
  "cached": false,
  "data": {
  "latitude": 39.875,
  "longitude": 116.375,
  "current_weather": {
    "temperature": 18.4,
    "windspeed": 9.7,
    "winddirection": 210,
    "weathercode": 3,
    "time": "2026-11-04T14:00"
  }
}
}

补充说明

天气代码对照

code 含义
0 晴
1-3 多云转阴
61-67 雨
71-77 雪

网关错误码

HTTP code 说明
400missing_param缺少必填参数,message 中会给出参数名
401invalid_key / need_login站点 Key 无效或未登录
402no_balance余额或积分不足,请充值后再调用
404api_not_found接口不存在或已下线
429rate_limited超出今日调用频率上限
502upstream_error接口服务不可达或响应异常,本次不扣费

相关接口