天气预报查询-API接口
查询 城市 县区的天气情况

接口地址: http://api.xcvts.cn/api/weather

返回格式: JSON

请求方式: GET

请求示例: http://api.xcvts.cn/api/weather?city=深圳 调用测试

请求参数说明:

名称 是否必填 类型 说明 接口测试
city String 需要查询的地区名称,例如:上海,深圳,成都 调用测试
type String 返回格式,默认json(text/json) 调用测试

返回参数说明:

名称 类型 说明

返回示例:

{
    "code": 1,
    "text": "获取成功",
    "data": {
        "city": "深圳",
        "cityEnglish": "shenzhen",
        "temp": "999",
        "tempn": "30",
        "weather": "阴转阵雨",
        "wind": "西南风转微风",
        "windSpeed": "3-4级转<3级",
        "time": "2025-07-10 08:00",
        "warning": {
            "windSpeed": "09",
            "wind": "雷电",
            "color": "黄色",
            "warning": "【深圳市雷电黄色预警信号】深圳市气象台于2025年07月09日18时01分发布全市雷电黄色预警信号,预计2小时内全市将受雷电影响。市民停留在安全地方。(预警信息来源:国家预警信息发布中心)",
            "time": "2025-07-10 18:02:00"
        },
        "current": {
            "city": "深圳",
            "cityEnglish": "shenzhen",
            "humidity": "94%",
            "wind": "南风",
            "windSpeed": "1级",
            "visibility": "11km",
            "weather": "小雨",
            "weatherEnglish": "Light rain",
            "temp": "25.1",
            "fahrenheit": "77.2",
            "air": "27",
            "air_pm25": "27",
            "date": "07月10日(星期四)",
            "time": "02:00",
            "image": "http://api.xcvts.cn/zaixian/weather/image/%E5%B0%8F%E9%9B%A8.png"
        },
        "living": [
            {
                "name": "穿衣指数",
                "index": "热",
                "tips": "适合穿T恤、短薄外套等夏季服装。"
            },
            {
                "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": "雨水带来一丝清凉,让烦躁的心绪降温。"
            },
            {
                "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": "温湿条件适宜,风速不大,皮肤无需特殊保养,只做日常护理即可。"
            }
        ]
    }
}

请求参数设置:

参数名称 参数值


{
    "code": 1,
    "text": "获取成功",
    "data": {
        "city": "深圳",
        "cityEnglish": "shenzhen",
        "temp": "999",
        "tempn": "30",
        "weather": "阴转阵雨",
        "wind": "西南风转微风",
        "windSpeed": "3-4级转<3级",
        "time": "2025-07-10 08:00",
        "warning": {
            "windSpeed": "09",
            "wind": "雷电",
            "color": "黄色",
            "warning": "【深圳市雷电黄色预警信号】深圳市气象台于2025年07月09日18时01分发布全市雷电黄色预警信号,预计2小时内全市将受雷电影响。市民停留在安全地方。(预警信息来源:国家预警信息发布中心)",
            "time": "2025-07-10 18:02:00"
        },
        "current": {
            "city": "深圳",
            "cityEnglish": "shenzhen",
            "humidity": "94%",
            "wind": "南风",
            "windSpeed": "1级",
            "visibility": "11km",
            "weather": "小雨",
            "weatherEnglish": "Light rain",
            "temp": "25.1",
            "fahrenheit": "77.2",
            "air": "27",
            "air_pm25": "27",
            "date": "07月10日(星期四)",
            "time": "02:00",
            "image": "http://api.xcvts.cn/zaixian/weather/image/%E5%B0%8F%E9%9B%A8.png"
        },
        "living": [
            {
                "name": "穿衣指数",
                "index": "热",
                "tips": "适合穿T恤、短薄外套等夏季服装。"
            },
            {
                "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": "雨水带来一丝清凉,让烦躁的心绪降温。"
            },
            {
                "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": "温湿条件适宜,风速不大,皮肤无需特殊保养,只做日常护理即可。"
            }
        ]
    }
}

错误码格式说明:

名称 类型 说明

代码示例: