AI问答开放平台 开发者文档 AI问答开放平台 开发者文档
首页
  • 简 介
  • 安 装
  • 快速开始
  • 返回响应码
  • AI接口

    • AI问答
    • AI画图
    • 通用文字识别
    • 身份证识别
    • AI识图
  • API接口

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

    • AI问答
    • AI画图
    • 通用文字识别
    • 身份证识别
    • AI识图
  • API接口

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

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

    • AI问答
    • AI画图
    • 通用文字识别
    • 身份证识别
    • AI识图
  • API接口

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

    获取天气信息

    # 接口信息

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

    # 请求地址

    https://api.vvhan.com/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 ApiClient apiClient;
    
    1
    2
    • 示例一 :推荐👍

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

    @org.junit.jupiter.api.Test
    public void getWeather() {
        String json = apiClient.getWeather("北京","","week");
        Map map1 = JSONUtil.toBean(json, Map.class);
        log.info(map1.toString());
    }
    
    1
    2
    3
    4
    5
    6

    响应示例:

    {
      "city": "北京市",
      "success": true,
      "info": {
        "date": "2024-02-25",
        "week": "星期日",
        "type": "晴",
        "low": "-4°C",
        "high": "10°C",
        "fengxiang": "北风",
        "fengli": "3-4级",
        "night": {
          "type": "多云",
          "fengxiang": "东风",
          "fengli": "1-3级"
        },
        "air": {
          "aqi": 51,
          "aqi_level": 2,
          "aqi_name": "良",
          "co": "0",
          "no2": "17",
          "o3": "56",
          "pm10": "51",
          "pm2.5": "20",
          "so2": "2"
        },
        "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
    30
    • 示例二:推荐👍
    @org.junit.jupiter.api.Test
    public void getWeather1() {
        String json = apiClient.getWeather();
        Map map1 = JSONUtil.toBean(json, Map.class);
        log.info(map1.toString());
    }
    
    1
    2
    3
    4
    5
    6

    响应示例:

    {
      "city": "北京市",
      "success": true,
      "info": {
        "date": "2024-02-25",
        "week": "星期日",
        "type": "晴",
        "low": "-4°C",
        "high": "10°C",
        "fengxiang": "北风",
        "fengli": "3-4级",
        "night": {
          "type": "多云",
          "fengxiang": "东风",
          "fengli": "1-3级"
        },
        "air": {
          "aqi": 51,
          "aqi_level": 2,
          "aqi_name": "良",
          "co": "0",
          "no2": "17",
          "o3": "56",
          "pm10": "51",
          "pm2.5": "20",
          "so2": "2"
        },
        "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
    30
    • 示例三:
    @org.junit.jupiter.api.Test
    public void getLoveTalk2() {
        ApiClient apiClient = new ApiClient("e59d77b733b5ff65e828df2db202b269", "69996d59f9bb7605d5867d90a93a686b");
        String json = apiClient.getWeather("上海","","today");
        Map map1 = JSONUtil.toBean(json, Map.class);
        log.info(map1.toString());
    } 
    
    1
    2
    3
    4
    5
    6
    7

    响应示例:

    {
      "city": "北京市",
      "success": true,
      "info": {
        "date": "2024-02-25",
        "week": "星期日",
        "type": "晴",
        "low": "-4°C",
        "high": "10°C",
        "fengxiang": "北风",
        "fengli": "3-4级",
        "night": {
          "type": "多云",
          "fengxiang": "东风",
          "fengli": "1-3级"
        },
        "air": {
          "aqi": 51,
          "aqi_level": 2,
          "aqi_name": "良",
          "co": "0",
          "no2": "17",
          "o3": "56",
          "pm10": "51",
          "pm2.5": "20",
          "so2": "2"
        },
        "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
    30

    # 更多示例详见:AI问答开放平台-SDK-Demo 示例项目 (opens new window)

    上次更新: 2024/05/15, 04:33:36
    每日星座运势
    随机壁纸

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

    Theme by Vdoing | Copyright © 2023-2024 Faiz | 赣ICP备2022007945号
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式