稳定、快速、免费的 API 接口服务
天气查询API
接口地址: https://api.suyanw.cn/api/weather.php
返回格式: 请看返回示例
请求方式: GET
请求示例: https://api.suyanw.cn/api/weather.php?city=广州
请求参数说明:
名称 | 必填 | 说明 |
---|---|---|
city | 是 | 需要查询的地区名 |
type | 否 | 返回格式,默认json可选text |
系统级错误:
名称 | 说明 |
---|---|
400 | 请求错误! |
403 | 请求被服务器拒绝! |
405 | 客户端请求的方法被禁止! |
408 | 请求时间过长! |
500 | 服务器内部出现错误! |
501 | 服务器不支持请求的功能,无法完成请求! |
503 | 系统维护中! |
返回示例:
{ "code": 1, "text": "获取成功", "data": { "city": "广州", "cityEnglish": "guangzhou", "temp": "28", "tempn": "22", "weather": "中雨转大雨", "wind": "微风", "windSpeed": "<3级", "time": "2025-04-24 08:00", "warning": {}, "current": { "city": "广州", "cityEnglish": "guangzhou", "humidity": "91%", "wind": "南风", "windSpeed": "1级", "visibility": "22km", "weather": "阴", "weatherEnglish": "Overcast", "temp": "27.9", "fahrenheit": "82.2", "air": "23", "air_pm25": "23", "date": "04月24日(星期四)", "time": "09:00", "image": "http://api.suyanw.cn/api/data/weather/image/云.png" }, "living": [ { "name": "穿衣指数", "index": "炎热", "tips": "建议穿短衫、短裤等清凉夏季服装。" }, { "name": "路况指数", "index": "湿滑", "tips": "路面湿滑,车辆易打滑,减慢车速。" }, { "name": "钓鱼指数", "index": "不宜", "tips": "天气太热,不适合垂钓。" }, { "name": "晨练指数", "index": "不宜", "tips": "有较强降水,建议在室内做适当锻炼。" }, { "name": "夜生活指数", "index": "较不适宜", "tips": "建议夜生活最好在室内进行。" }, { "name": "感冒指数", "index": "少发", "tips": "感冒机率较低,避免长期处于空调屋中。" }, { "name": "逛街指数", "index": "不适宜", "tips": "有较强降水,坚持出门需带雨具。" }, { "name": "空气污染扩散条件指数", "index": "优", "tips": "气象条件非常有利于空气污染物扩散。" }, { "name": "旅游指数", "index": "一般", "tips": "天气较热,有较强降雨不便出行。" }, { "name": "舒适度指数", "index": "较不舒适", "tips": "多云,湿度偏大,闷热。" }, { "name": "啤酒指数", "index": "适宜", "tips": "天热潮湿,适宜饮用冰镇啤酒,不要贪杯。" }, { "name": "划船指数", "index": "不适宜", "tips": "天气不好,建议选择别的娱乐方式。" }, { "name": "太阳镜指数", "index": "不需要", "tips": "白天能见度差不需要佩戴太阳镜" }, { "name": "紫外线强度指数", "index": "最弱", "tips": "辐射弱,涂擦SPF8-12防晒护肤品。" }, { "name": "风寒指数", "index": "无", "tips": "温度未达到风寒所需的低温,稍作防寒准备即可。" }, { "name": "放风筝指数", "index": "不宜", "tips": "天气不好,不适宜放风筝。" }, { "name": "空调开启指数", "index": "部分时间开启", "tips": "天热湿度大,需适当开启制冷空调。" }, { "name": "晾晒指数", "index": "不宜", "tips": "有较强降水会淋湿衣物,不适宜晾晒。" }, { "name": "洗车指数", "index": "不宜", "tips": "有雨,雨水和泥水会弄脏爱车。" }, { "name": "心情指数", "index": "差", "tips": "有较强降水,使人心情不佳,注意调节。" }, { "name": "中暑指数", "index": "极易发", "tips": "使人汗流浃背的桑拿天来了,要注意随时补充水分~" }, { "name": "交通指数", "index": "较差", "tips": "有强降水且路面湿滑,注意控制车速。" }, { "name": "约会指数", "index": "不适宜", "tips": "建议在室内约会,免去天气的骚扰。" }, { "name": "运动指数", "index": "较不宜", "tips": "有降水,推荐您在室内进行休闲运动。" }, { "name": "过敏指数", "index": "较易发", "tips": "需注意远离过敏源,适当采取防护措施。" }, { "name": "美发指数", "index": "一般", "tips": "天热,头皮皮脂分泌多,注意清洁。" }, { "name": "雨伞指数", "index": "带伞", "tips": "较强降水,带雨伞,避免淋湿。" }, { "name": "防晒指数", "index": "弱", "tips": "涂抹8-12SPF防晒护肤品。" }, { "name": "化妆指数", "index": "防脱水", "tips": "请选用防脱水化妆品。" }, { "name": "干燥指数", "index": "适宜", "tips": "温湿条件适宜,风速不大,皮肤无需特殊保养,只做日常护理即可。" } ] } }
错误码格式说明:
名称 | 类型 | 说明 |
---|---|---|
无 | 无 | 无 |
调用示例:
无