Qi-API 开发者文档 Qi-API 开发者文档
首页
  • 简 介
  • 安 装
  • 快速开始
  • 返回响应码
  • API接口

    • 随机毒鸡汤
    • 获取IP信息归属地
    • 随机土味情话
    • 每日星座运势
    • 获取天气信息
    • 随机壁纸
  • 使用配置
赞助
Demo (opens new window)
GitHub (opens new window)
首页
  • 简 介
  • 安 装
  • 快速开始
  • 返回响应码
  • API接口

    • 随机毒鸡汤
    • 获取IP信息归属地
    • 随机土味情话
    • 每日星座运势
    • 获取天气信息
    • 随机壁纸
  • 使用配置
赞助
Demo (opens new window)
GitHub (opens new window)
  • 指南

    • 简 介
    • 安 装
    • 快速开始
    • 返回响应码
  • API接口

    • 随机毒鸡汤
    • 获取IP信息归属地
    • 随机土味情话
    • 每日星座运势
    • 获取天气信息
      • 随机壁纸
    目录

    获取天气信息

    # 接口信息

    • 接口状态 : 正常
    • 请求方式 :GET
    • 返回格式 :JSON
    • 扣除积分数 :1

    # 请求地址

    https://gateway.qimuu.icu/api/weather
    
    1

    # 请求参数

    参数名 必选 类型 描述
    city 否 string 城市
    ip 否 string ip地址
    type 否 string 默认一天,可配置 week获取一周

    # 响应参数

    参数名称 类型 描述
    code int 响应码
    data.city string 城市名称
    data.info.date string 日期
    data.info.week string 星期几
    data.info.type string 天气类型
    data.info.low string 最低温度
    data.info.high string 最高温度
    data.info.fengxiang string 风向
    data.info.fengli string 风力
    data.info.night.type string 夜间天气类型
    data.info.night.fengxiang string 夜间风向
    data.info.night.fengli string 夜间风力
    data.info.air.aqi int 空气质量指数
    data.info.air.aqi_level int 空气质量指数级别
    data.info.air.aqi_name string 空气质量指数名称
    data.info.air.co string 一氧化碳浓度
    data.info.air.no2 string 二氧化氮浓度
    data.info.air.o3 string 臭氧浓度
    data.info.air.pm10 string PM10浓度
    data.info.air.pm2.5 string PM2.5浓度
    data.info.air.so2 string 二氧化硫浓度
    data.info.tip string 提示信息
    message string 响应描述

    # 代码示例

    注意 🔔️

    没有开发者调用凭证无法调用接口哦!!! 前往获取开发者凭证 (opens new window)

    注入Service

    @Resource
    private ApiService apiService;
    
    1
    2
    • 示例一 :推荐👍

    通过yml配置开发者调用凭证

    @GetMapping("/weatherInfo")
    public ResultResponse getWeatherInfo(WeatherParams weatherParams) {
        ResultResponse resultResponse;
        try {
            WeatherRequest weatherRequest = new WeatherRequest();
            weatherRequest.setRequestParams(weatherParams);
            resultResponse = apiService.getWeatherInfo(weatherRequest);
        } catch (ApiException e) {
            throw new BusinessException(e.getCode(), e.getMessage());
        }
        return resultResponse;
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

    响应示例:

    {
        "city": "驻马店市",
        "info": {
            "date": "2023-09-23",
            "week": "星期六",
            "type": "中雨",
            "low": "15°C",
            "high": "19°C",
            "fengxiang": "东风",
            "fengli": "4级",
            "night": {
                "type": "中雨",
                "fengxiang": "东北风",
                "fengli": "4级"
            },
            "air": {
                "aqi": 26,
                "aqi_level": 1,
                "aqi_name": "优",
                "co": "0",
                "no2": "7",
                "o3": "83",
                "pm10": "12",
                "pm2.5": "14",
                "so2": "6"
            },
            "tip": "下小雨了,出门记得带伞~ 现在的温度比较凉爽~"
        }
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    • 示例二:推荐👍

    搭配EasyWeb (opens new window)快速开发Web项目

    @GetMapping("/weatherInfo/EasyWeb")
    public BaseResponse<ResultResponse> getWeatherInfoEasyWeb(WeatherParams weatherParams) {
        ResultResponse resultResponse;
        try {
            WeatherRequest weatherRequest = new WeatherRequest();
            weatherRequest.setRequestParams(weatherParams);
            resultResponse = apiService.getWeatherInfo(weatherRequest);
        } catch (ApiException e) {
            throw new BusinessException(e.getCode(), e.getMessage());
        }
        return ResultUtils.success(resultResponse);
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

    响应示例:

    {
        "code": 0,
        "data": {
            "city": "驻马店市",
            "info": {
                "date": "2023-09-23",
                "week": "星期六",
                "type": "中雨",
                "low": "15°C",
                "high": "19°C",
                "fengxiang": "东风",
                "fengli": "4级",
                "night": {
                    "type": "中雨",
                    "fengxiang": "东北风",
                    "fengli": "4级"
                },
                "air": {
                    "aqi": 26,
                    "aqi_level": 1,
                    "aqi_name": "优",
                    "co": "0",
                    "no2": "7",
                    "o3": "83",
                    "pm10": "12",
                    "pm2.5": "14",
                    "so2": "6"
                },
                "tip": "下小雨了,出门记得带伞~ 现在的温度比较凉爽~"
            }
        },
        "message": "ok"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    • 示例三:
    @GetMapping("/weatherInfo/setKey")
    public ResultResponse getWeatherInfoSetKey(WeatherParams weatherParams) {
        ResultResponse resultResponse;
        QiApiClient qiApiClient = new QiApiClient("7052a8594339a519e0ba5eb04a267a60", "d8d6df60ab209385a09ac796f1dfe3e1");
        try {
            WeatherRequest weatherRequest = new WeatherRequest();
            weatherRequest.setRequestParams(weatherParams);
            resultResponse = apiService.getWeatherInfo(qiApiClient, weatherRequest);
        } catch (ApiException e) {
            throw new BusinessException(e.getCode(), e.getMessage());
        }
        return resultResponse;
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

    # 更多示例详见:Qi-API-SDK-Demo 示例项目 (opens new window)

    帮助我们改善此页面! (opens new window)
    上次更新: 2023/09/23, 16:56:48
    每日星座运势
    随机壁纸

    ← 每日星座运势 随机壁纸→

    Theme by Vdoing | Copyright © 2023-2024 Qi Mu | 豫ICP备2023004098号-1
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式