Skip to content

getWeather

调用该接口获取城市天气信息

使用说明

请求头必须带token信息。

请求方式

POST

请求参数

CityWeatherReq

名称类型是否必选描述
cityNameString城市名称
cityCodeString城市编码

返回数据

CityWeatherResp

名称类型必选约束中文名说明
» codestringtruenone返回编码0是成功none
» msgstringtruenone返回消息none
» dataobjecttruenonenone
»» stationobjecttruenone站点信息none
»»» idnulltruenonenone
»»» urlstringtruenone城市跳转地址none
»»» codestringtruenone城市编码none
»»» citystringtruenone城市名称none
»»» provincestringtruenone省份名称none
»» publishTimestringtruenone发布时间none
»» weatherobjecttruenone天气预报none
»»» temperaturenumbertruenone当前气温值为9999是异常值无需显示
»»» temperatureDiffnumbertruenone温差值为9999是异常值无需显示
»»» airpressureintegertruenone气压 单位Panone
»»» humidityintegertruenone相对湿度none
»»» rainintegertruenone雨量等级none
»»» rcomfortintegertruenone舒适度none
»»» icomfortintegertruenone舒适度图标none
»»» infostringtruenone当前天气状况none
»»» imgstringtruenone天气图标值为9999是异常值无需显示
»»» feelstnumbertruenone体感温度值为9999是异常值无需显示
»»» airQualitynulltruenone值为9999是异常值无需显示
»» windobjecttruenone风量信息值为9999是异常值无需显示
»»» directstringtruenone风向值为9999是异常值无需显示
»»» powerstringtruenone风力值为9999是异常值无需显示
»»» speedstringtruenone风速值为9999是异常值无需显示
»» warnobjecttruenone警告信息值为9999是异常值无需显示
»»» alertstringtruenone值为9999是异常值无需显示
»»» picstringtruenonenone
»»» provincestringtruenonenone
»»» citystringtruenonenone
»»» urlstringtruenonenone
»»» issuecontentstringtruenonenone
»»» fmeansstringtruenonenone

示例

请求示例

json
{
  "cityName": "虎林",
  "cityCode": "50983"
}

返回示例

json
{
  "code": "0",
  "msg": "操作成功",
  "data": {
    "station": {
      "id": null,
      "url": "http://www.nmc.cnhttp://www.nmc.cn/publish/forecast/AHL/hulin.html",
      "code": "50983",
      "city": "虎林",
      "province": "黑龙江省"
    },
    "publishTime": "2023-03-01 10:15",
    "weather": {
      "temperature": -2.5,
      "temperatureDiff": -4.3,
      "airpressure": 9999,
      "humidity": 39,
      "rain": 0,
      "rcomfort": 32,
      "icomfort": -3,
      "info": "",
      "img": "0",
      "feelst": -6.4,
      "airQuality": null
    },
    "wind": {
      "direct": "西北风",
      "power": "微风",
      "speed": "2.3"
    },
    "warn": {
      "alert": "2023年02月28日09时黑龙江省鸡西市虎林市气象台发布寒潮蓝色预警信号",
      "pic": "http://image.nmc.cn/assets/img/alarm/p0004004.png",
      "province": "黑龙江省",
      "city": "鸡西市",
      "url": "/publish/alarm/23038141600000_20230228092446.html",
      "issuecontent": "虎林气象台2023年2月28日9时30分发布寒潮蓝色预警信号:预计未来48小时内,虎林地区最低气温将下降8℃以上,请有关单位和个人做好预防工作。",
      "fmeans": "1.政府及有关部门按照职责做好防寒潮准备工作;2.注意添衣保暖;3.对热带作物、水产品采取一定的防护措施;4.做好防风准备工作。"
    }
  }
}

错误码

错误码错误码取值解决方案
0-100006鉴权参数为空请确保传递入参。
0-101079账号被禁用请联系管理员联系管理员
0-101080账号已失效联系管理员
0-101081当前账号暂未分配权限联系管理员