AJAX阶段
  1. 天气预报
AJAX阶段
  • 欢迎使用
  • 省市区
    • 获取-省份列表
      GET
    • 获取-城市列表
      GET
    • 获取-地区列表
      GET
  • 新闻接口
    • 获取-新闻列表
      GET
  • 注册和登录
    • 注册账号
      POST
    • 登录
      POST
  • 图书管理
    • 获取-图书列表
      GET
    • 新增-图书
      POST
    • 删除-图书
      DELETE
    • 获取-图书详情
      GET
    • 修改-图书详情
      PUT
  • 图片上传
    • 上传-图片
      POST
  • 个人信息
    • 获取-个人信息
      GET
    • 修改-个人头像
      PUT
    • 修改-个人信息
      PUT
  • 天气预报
    • 获取-天气预报
      GET
    • 获取-天气预报城市信息
      GET
  • 商品分类
    • 获取-一级商品分类
      GET
    • 获取-二级商品分类
      GET
  • 学习反馈
    • 提交-反馈记录
      POST
  • 作业接口
    • 机器人聊天
    • 必要商城-搜索结果
    • 必要商城-一级分类列表
    • 必要商城-二级分类列表
    • 必要商城-三级分类列表
    • 英雄百科-列表
    • 英雄百科-搜索
    • 英雄百科-详情
    • 获取-评论列表
    • 新增-评论
    • 删除-评论
  • 其他接口
    • 获取-励志短句
    • 查看-运势
    • 获取-随机笑话
  1. 天气预报

获取-天气预报

GET
https://hmajax.itheima.net/api/weather
AJAX编程/天气预报
获取-天气预报

请求参数

Query 参数
city
string 
必需
城市code,北京市:110100
示例值:
110100

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://hmajax.itheima.net/api/weather?city=110100'

返回响应

🟢200成功
application/json
Body
code
integer 
响应编码
必需
message
string 
响应消息
必需
data
object 
响应数据
必需
date
string 
日期
必需
area
string 
地区
必需
dateShort
string 
阳历日期
必需
dateLunar
string 
农历日期
必需
dayForecast
array [object {8}] 
一周天气
必需
psPm25
string 
PM指数
必需
psPm25Level
string 
PM等级
必需
temperature
string 
温度
必需
当日温度
todayWeather
object 
今日天气
必需
weather
string 
天气
必需
weatherImg
string 
天气图片
必需
windDirection
string 
风向
必需
windPower
string 
风力等级
必需
示例
{
  "code": 10000,
  "message": "查询天气成功",
  "data": {
    "date": "2023-02-12",
    "area": "北京市",
    "dateShort": "02月12日",
    "dateLunar": "正月廿二",
    "temperature": "3",
    "weather": "霾",
    "weatherImg": "https://hmajax.itheima.net/weather/mailine.png",
    "windPower": "1级",
    "windDirection": "东风",
    "psPm25Level": "中度",
    "psPm25": "172",
    "todayWeather": {
      "humidity": "69.0",
      "sunriseTime": "07:12",
      "sunsetTime": "17:46",
      "ultraviolet": "最弱",
      "weather": "雨夹雪",
      "temDay": "3",
      "temNight": "-5"
    },
    "dayForecast": [
      {
        "date": "02月12日",
        "temDay": "3",
        "weather": "雨夹雪",
        "temNight": "-5",
        "windPower": "<3级",
        "dateFormat": "今天",
        "weatherImg": "https://hmajax.itheima.net/weather/yujiaxue.png",
        "windDirection": "东北风"
      },
      {
        "date": "02月13日",
        "temDay": "7",
        "weather": "晴",
        "temNight": "-4",
        "windPower": "<3级",
        "dateFormat": "明天",
        "weatherImg": "https://hmajax.itheima.net/weather/qing.png",
        "windDirection": "北风"
      },
      {
        "date": "02月14日",
        "temDay": "6",
        "weather": "多云",
        "temNight": "-5",
        "windPower": "<3级",
        "dateFormat": "后天",
        "weatherImg": "https://hmajax.itheima.net/weather/duoyun.png",
        "windDirection": "南风"
      },
      {
        "date": "02月15日",
        "temDay": "4",
        "weather": "多云",
        "temNight": "-6",
        "windPower": "<3级",
        "dateFormat": "周三",
        "weatherImg": "https://hmajax.itheima.net/weather/duoyun.png",
        "windDirection": "南风"
      },
      {
        "date": "02月16日",
        "temDay": "6",
        "weather": "晴",
        "temNight": "-5",
        "windPower": "<3级",
        "dateFormat": "周四",
        "weatherImg": "https://hmajax.itheima.net/weather/qing.png",
        "windDirection": "南风"
      },
      {
        "date": "02月17日",
        "temDay": "4",
        "weather": "多云",
        "temNight": "0",
        "windPower": "<3级",
        "dateFormat": "周五",
        "weatherImg": "https://hmajax.itheima.net/weather/duoyun.png",
        "windDirection": "北风"
      },
      {
        "date": "02月18日",
        "temDay": "6",
        "weather": "多云",
        "temNight": "-1",
        "windPower": "<3级",
        "dateFormat": "周六",
        "weatherImg": "https://hmajax.itheima.net/weather/duoyun.png",
        "windDirection": "东南风"
      }
    ]
  }
}
🟠400请求参数缺失_AJAX
🟠400没有查询到数据
上一页
修改-个人信息
下一页
获取-天气预报城市信息
Built with