返回首页

天气情况API接口

接口说明

可查 城市 县区的天气情况

接口基本信息

API地址

https://api.cenguigui.cn/api/WeatherInfo/

请求方式

GET

返回格式

JSON

接口状态

正常启用

参数说明

以下参数为接口所需调用信息

参数 是否必填 说明
天气查询接口city=城市city必须加城市才能调用

请求示例

HTTP请求

https://api.cenguigui.cn/api/WeatherInfo/?city=北京

返回结果

HTTP 200 OK
{ "code": 200, "msg": "请求成功", "data": { "today": { "current_temp": "29℃", "current_cond": "阴", "night_condition": "多云", "tomorrow_condition": "阴转多云", "low": "24℃", "quality": "良", "alert": "市气象台2023年6月24日21时00分降级发布高温黄色预警信号:预计,6月25日至27日最高气温较22日至24日有所降低,大部分地区最高气温35~37℃,请注意防范。(预警信息来源:国家预警信息发布中心)", "update_time": "2023-06-25 09:55:08" }, "seven_day": [ { "date": "2023-06-24", "cond": "晴", "high": "40℃", "low": "25℃" }, { "date": "2023-06-25", "cond": "多云", "high": "35℃", "low": "24℃" }, { "date": "2023-06-26", "cond": "阴转多云", "high": "35℃", "low": "25℃" }, { "date": "2023-06-27", "cond": "多云", "high": "37℃", "low": "26℃" }, { "date": "2023-06-28", "cond": "小雨转多云", "high": "35℃", "low": "25℃" }, { "date": "2023-06-29", "cond": "多云转晴", "high": "38℃", "low": "24℃" }, { "date": "2023-06-30", "cond": "多云", "high": "38℃", "low": "23℃" }, { "date": "2023-07-01", "cond": "多云", "high": "36℃", "low": "24℃" }, { "date": "2023-07-02", "cond": "阴", "high": "39℃", "low": "27℃" }, { "date": "2023-07-03", "cond": "小雨", "high": "38℃", "low": "25℃" }, { "date": "2023-07-04", "cond": "小雨转阴", "high": "35℃", "low": "22℃" }, { "date": "2023-07-05", "cond": "阴转多云", "high": "39℃", "low": "25℃" }, { "date": "2023-07-06", "cond": "阴", "high": "39℃", "low": "30℃" }, { "date": "2023-07-07", "cond": "小雨", "high": "39℃", "low": "25℃" }, { "date": "2023-07-08", "cond": "小雨", "high": "39℃", "low": "22℃" }, { "date": "2023-07-09", "cond": "阴转多云", "high": "39℃", "low": "27℃" } ] }, "info": { "request": { "state": "92dff1b360399bd5a31f985b09063d40", "request_id": "64979fee0d54e", "method": "GET", "api_id": "1", "api_action": "WeatherInfo", "api_name": "客户端信息", "path": "/api/WeatherInfo/?city=%E5%8C%97%E4%BA%AC", "query": { "city": "北京" }, "cdn_node": "当前请求由阿里云CDN加速" }, "developer": { "author": "笒鬼鬼", "home": "https://www.cenguigui.cn", "mail": "cengugiui@qq.com", "notice": "交流Q群 695288151", "time": "2023-06-25 10:01:18" } } }

调用示例

https://api.cenguigui.cn/api/WeatherInfo/?city=城市(列如:北京)

搜索比较快的接口(不要加省和县字):
https://api.cenguigui.cn/api/WeatherInfo/api.php?city=北京

经纬度天气:
https://api.cenguigui.cn/api/WeatherInfo/latlon.php?lat=34.442&lon=118.648

示例代码

https://api.cenguigui.cn/api/WeatherInfo/?city=北京