GET
数据查询
天气
天气预报,来源天气网
累计调用 12
今日调用 0
更新于 2026-10-16
调用地址
GET
https://itapi.top/api/weather
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| city | string | 必填 | 国内地区 | 暂无 |
| type | string | 可选 | 返回格式 | 暂无 |
返回字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| code | number | 状态码 |
| message | string | 返回提示 |
| data | array | 返回数据 |
| data.city | string | 地区 |
| data.cityEnglish | string | 地区英文 |
| data.temp | number | 高温 |
| data.tempn | number | 低温 |
| data.weather | string | 天气 |
| data.wind | string | 风向 |
| data.windSpeed | string | 风级风速 |
| data.time | string | 时间 |
| data.warning | array | 警告 |
| data.warning.* | default | 警告内容 |
| data.current | array | 当前天气 |
| data.current.city | string | 地区 |
| data.current.cityEnglish | string | 地区英文 |
| data.current.humidity | string | 湿度 |
| data.current.wind | string | 风向 |
| data.current.windSpeed | string | 风级风速 |
| data.current.visibility | string | 能见度 |
| data.current.weather | string | 天气 |
| data.current.weatherEnglish | string | 天气英文 |
| data.current.temp | number | 温度 |
| data.current.fahrenheit | number | 华氏度 |
| data.current.air | number | 空气质量 |
| data.current.air_pm25 | number | pm2.5 |
| data.current.date | string | 日期 |
| data.current.time | string | 时间 |
| data.current.image | string | 天气图片 |
| data.living | array | 指数 |
| data.living.*.name | string | 指数名称 |
| data.living.*.index | string | 环境 |
| data.living.*.tips | string | 评价 |
响应示例
200 OK
{"code":1,"message":"地区:北京\n天气:多云\n风向:东风\n风速:1级\n能见度:21km\n空气指数:53\n更新时间:10月16日(星期五) 19:30","data":{"city":"北京","cityEnglish":"beijing","temp":"17.4","tempn":"14","weather":"阴转小雨","wind":"东北风转北风","windSpeed":"3-4级转<3级","time":"2026-10-16 19:30","warning":[],"current":{"city":"北京","cityEnglish":"beijing","humidity":"45%","wind":"东风","windSpeed":"1级","visibility":"21km","weather":"多云","weatherEnglish":"Cloudy","temp":"17.4","fahrenheit":"63.3","air":"53","air_pm25":"53","date":"10月16日(星期五)","time":"19:30","image":"https:\/\/oiapi.net\/static\/weather\/多云.png"},"living":[{"name":"路况指数","index":"潮湿","tips":"有降水,路面潮湿,请小心驾驶。"},{"name":"晨练指数","index":"不宜","tips":"有较强降水,建议在室内做适当锻炼。"},{"name":"逛街指数",...
在线测试
代码示例
cURL · GET
curl "https://itapi.top/api/weather?city=%E6%9A%82%E6%97%A0&type=%E6%9A%82%E6%97%A0"
PHP
<?php
$res = file_get_contents("https://itapi.top/api/weather?city=%E6%9A%82%E6%97%A0&type=%E6%9A%82%E6%97%A0");
$json = json_decode($res, true);
print_r($json);
JavaScript
const res = await fetch("https://itapi.top/api/weather?city=%E6%9A%82%E6%97%A0&type=%E6%9A%82%E6%97%A0");
const json = await res.json();
console.log(json);
Python
import requests
r = requests.get("https://itapi.top/api/weather?city=%E6%9A%82%E6%97%A0&type=%E6%9A%82%E6%97%A0", timeout=10)
print(r.json())