天气查询-天气预报-全国天气预报-实时天气查询-天气预报查询-24小时天气查询
【摘要】 前言天气查询通过调用气象接口服务,获取指定地区的实时天气、未来预报、温度、降水、风力、湿度、空气质量、灾害预警等气象数据。可通过地名、地名对应ID、坐标区域、IP地址、景点名称ID、电话区号或邮编来查询天气情况。可查询到当前天气、未来24小时天气、未来7天、15天、40天内的天气情况的数据。天气查询应用场景如下:1.出行类APP/小程序打车、导航、公交、旅游软件,根据用户定位展示实时天气,...
前言
天气查询通过调用气象接口服务,获取指定地区的实时天气、未来预报、温度、降水、风力、湿度、空气质量、灾害预警等气象数据。可通过地名、地名对应ID、坐标区域、IP地址、景点名称ID、电话区号或邮编来查询天气情况。可查询到当前天气、未来24小时天气、未来7天、15天、40天内的天气情况的数据。
天气查询应用场景如下:
1.出行类APP/小程序
打车、导航、公交、旅游软件,根据用户定位展示实时天气,提示雨雪、大风等天气,辅助规划出行路线。
**2.生活服务APP **
天气软件、日历、健康类应用,推送天气预警,提醒用户增减衣物、防范高温、寒潮。
API介绍
天气查询包括十个API,分别为:天气查询-按地名、天气查询-按IP、天气查询-按经纬度、天气查询-按景点、天气查询-查询地名id、天气查询-查询景点id、天气查询-24小时、天气查询-未来7天内指定日期、天气查询-未来15天、天气查询-历史天气
戳这里查看详情
天气查询-按地名
根据地名查询当前和未来7天的天气。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| area | String | 否 | 地名 地名不能带有“市”、“县”,比如查杭州,area传入“杭州”,而不是传入“杭州市” |
| areaId | String | 否 | 地名Id |
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "51168811490923554212", // 本次请求号
"data": {
"area": "北京", // 地名 详见 地名说明
"areaId": "101010100", // 地名id 详见 地名说明
"province": "北京", // 省份
"city": "北京", // 城市
"now": { // 当前实时天气
"sd": "61%", // 湿度
"aqi": "87", // 空气质量
"weather": "晴", // 天气
"weather_pic": "xxxx/weather-icon/d00.png", // 天气图标
"temperature": "10", // 温度
"wind_direction": "东北风", // 风向
"wind_power": "1级" // 风级
},
"dayWeathers": [ // 未来7天天气,按日期从早到晚排序
{
"daytime": "20211116", // 日期
"day_weather": "晴", // 白天天气
"day_weather_code": "00", // 白天天气编号,详见天气编号
"day_weather_pic": "xxxx/weather-icon/d00.png", // 白天天气图标
"day_high_temperature": "12", // 白天最高温度
"day_wind_direction": "西南风", // 白天风向
"day_wind_power": "<3级", // 白天风级
"night_weather": "多云", // 夜间天气
"night_weather_code": "01", // 夜间天气编号
"night_weather_pic": "xxxx/weather-icon/n01.png", // 夜间天气图标
"night_low_temperature": "1", // 夜间最低温度
"night_wind_direction": "西南风", // 夜间风向
"night_wind_power": "<3级" // 夜间风级
},
{
"daytime": "20211117",
"day_weather_code": "00",
"day_high_temperature": "13",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西南风",
"night_wind_power": "<3级",
"night_low_temperature": "0",
"night_wind_direction": "西南风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴"
},
{
"daytime": "20211118",
"day_weather_code": "00",
"day_high_temperature": "12",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "南风",
"night_low_temperature": "2",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "<3级"
},
{
"daytime": "20211119",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "3",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n01.png",
"night_weather_code": "01",
"night_weather": "多云",
"night_wind_power": "<3级"
},
{
"daytime": "20211120",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "1",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
},
{
"daytime": "20211121",
"day_weather_code": "00",
"day_high_temperature": "8",
"day_weather": "晴",
"day_wind_power": "4-5级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西北风",
"night_low_temperature": "-2",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "4-5级"
},
{
"daytime": "20211122",
"day_weather_code": "00",
"day_high_temperature": "4",
"day_weather": "晴",
"day_wind_power": "3-4级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西北风",
"night_low_temperature": "-4",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
}
]
}
}
天气查询-按IP
根据IP地址查询当前和未来7天的天气。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| ip | String | 是 | IP地址 |
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "51168811490923554212", // 本次请求号
"data": {
"area": "北京", // ip所在地区
"areaId": "101010100", // 地名id 详见 地名说明
"province": "北京", // 省份
"city": "北京", // 城市
"now": { // 当前实时天气
"sd": "61%", // 湿度
"aqi": "87", // 空气质量
"weather": "晴", // 天气
"weather_pic": "xxxx/weather-icon/d00.png", // 天气图标
"temperature": "10", // 温度
"wind_direction": "东北风", // 风向
"wind_power": "1级" // 风级
},
"dayWeathers": [ // 未来7天天气,按日期从早到晚排序
{
"daytime": "20211116", // 日期
"day_weather": "晴", // 白天天气
"day_weather_code": "00", // 白天天气编号,详见天气编号
"day_weather_pic": "xxxx/weather-icon/d00.png", // 白天天气图标
"day_high_temperature": "12", // 白天最高温度
"day_wind_direction": "西南风", // 白天风向
"day_wind_power": "<3级", // 白天风级
"night_weather": "多云", // 夜间天气
"night_weather_code": "01", // 夜间天气编号
"night_weather_pic": "xxxx/weather-icon/n01.png", // 夜间天气图标
"night_low_temperature": "1", // 夜间最低温度
"night_wind_direction": "西南风", // 夜间风向
"night_wind_power": "<3级" // 夜间风级
},
{
"daytime": "20211117",
"day_weather_code": "00",
"day_high_temperature": "13",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西南风",
"night_wind_power": "<3级",
"night_low_temperature": "0",
"night_wind_direction": "西南风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴"
},
{
"daytime": "20211118",
"day_weather_code": "00",
"day_high_temperature": "12",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "南风",
"night_low_temperature": "2",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "<3级"
},
{
"daytime": "20211119",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "3",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n01.png",
"night_weather_code": "01",
"night_weather": "多云",
"night_wind_power": "<3级"
},
{
"daytime": "20211120",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "1",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
},
{
"daytime": "20211121",
"day_weather_code": "00",
"day_high_temperature": "8",
"day_weather": "晴",
"day_wind_power": "4-5级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西北风",
"night_low_temperature": "-2",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "4-5级"
},
{
"daytime": "20211122",
"day_weather_code": "00",
"day_high_temperature": "4",
"day_weather": "晴",
"day_wind_power": "3-4级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西北风",
"night_low_temperature": "-4",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
}
]
}
}
天气查询-按经纬度
根据经纬度查询当前和未来7天的天气。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| longitude | String | 是 | 经度,取值范围【0°-180°】 |
| latitude | String | 是 | 纬度,取值范围【0°-90°】 |
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "51168811490923554212", // 本次请求号
"data": {
"area": "北京", // 地区
"areaId": "101010100", // 地名id 详见 地名说明
"province": "北京", // 省份
"city": "北京", // 城市
"now": { // 当前实时天气
"sd": "61%", // 湿度
"aqi": "87", // 空气质量
"weather": "晴", // 天气
"weather_pic": "xxxx/weather-icon/d00.png", // 天气图标
"temperature": "10", // 温度
"wind_direction": "东北风", // 风向
"wind_power": "1级" // 风级
},
"dayWeathers": [ // 未来7天天气,按日期从早到晚排序
{
"daytime": "20211116", // 日期
"day_weather": "晴", // 白天天气
"day_weather_code": "00", // 白天天气编号,详见天气编号
"day_weather_pic": "xxxx/weather-icon/d00.png", // 白天天气图标
"day_high_temperature": "12", // 白天最高温度
"day_wind_direction": "西南风", // 白天风向
"day_wind_power": "<3级", // 白天风级
"night_weather": "多云", // 夜间天气
"night_weather_code": "01", // 夜间天气编号
"night_weather_pic": "xxxx/weather-icon/n01.png", // 夜间天气图标
"night_low_temperature": "1", // 夜间最低温度
"night_wind_direction": "西南风", // 夜间风向
"night_wind_power": "<3级" // 夜间风级
},
{
"daytime": "20211117",
"day_weather_code": "00",
"day_high_temperature": "13",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西南风",
"night_wind_power": "<3级",
"night_low_temperature": "0",
"night_wind_direction": "西南风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴"
},
{
"daytime": "20211118",
"day_weather_code": "00",
"day_high_temperature": "12",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "南风",
"night_low_temperature": "2",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "<3级"
},
{
"daytime": "20211119",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "3",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n01.png",
"night_weather_code": "01",
"night_weather": "多云",
"night_wind_power": "<3级"
},
{
"daytime": "20211120",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "1",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
},
{
"daytime": "20211121",
"day_weather_code": "00",
"day_high_temperature": "8",
"day_weather": "晴",
"day_wind_power": "4-5级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西北风",
"night_low_temperature": "-2",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "4-5级"
},
{
"daytime": "20211122",
"day_weather_code": "00",
"day_high_temperature": "4",
"day_weather": "晴",
"day_wind_power": "3-4级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西北风",
"night_low_temperature": "-4",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
}
]
}
}
天气查询-按景点
根据景点查询当前和未来7天的天气。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| scenery | String | 否 | 景点名称,景点id和名称至少传递一个 |
| sceneryId | String | 否 | 景点id ,景点id和名称至少传递一个 |
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "51168811490923554212", // 本次请求号
"data": {
"area": "北京", // 景点所在地区
"areaId": "101010100", // 地名id 详见 地名说明
"province": "北京", // 省份
"city": "北京", // 城市
"now": { // 当前实时天气
"sd": "61%", // 湿度
"aqi": "87", // 空气质量
"weather": "晴", // 天气
"weather_pic": "xxxx/weather-icon/d00.png", // 天气图标
"temperature": "10", // 温度
"wind_direction": "东北风", // 风向
"wind_power": "1级" // 风级
},
"dayWeathers": [ // 未来7天天气,按日期从早到晚排序
{
"daytime": "20211116", // 日期
"day_weather": "晴", // 白天天气
"day_weather_code": "00", // 白天天气编号,详见天气编号
"day_weather_pic": "xxxx/weather-icon/d00.png", // 白天天气图标
"day_high_temperature": "12", // 白天最高温度
"day_wind_direction": "西南风", // 白天风向
"day_wind_power": "<3级", // 白天风级
"night_weather": "多云", // 夜间天气
"night_weather_code": "01", // 夜间天气编号
"night_weather_pic": "xxxx/weather-icon/n01.png", // 夜间天气图标
"night_low_temperature": "1", // 夜间最低温度
"night_wind_direction": "西南风", // 夜间风向
"night_wind_power": "<3级" // 夜间风级
},
{
"daytime": "20211117",
"day_weather_code": "00",
"day_high_temperature": "13",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西南风",
"night_wind_power": "<3级",
"night_low_temperature": "0",
"night_wind_direction": "西南风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴"
},
{
"daytime": "20211118",
"day_weather_code": "00",
"day_high_temperature": "12",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "南风",
"night_low_temperature": "2",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "<3级"
},
{
"daytime": "20211119",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "3",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n01.png",
"night_weather_code": "01",
"night_weather": "多云",
"night_wind_power": "<3级"
},
{
"daytime": "20211120",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "1",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
},
{
"daytime": "20211121",
"day_weather_code": "00",
"day_high_temperature": "8",
"day_weather": "晴",
"day_wind_power": "4-5级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西北风",
"night_low_temperature": "-2",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "4-5级"
},
{
"daytime": "20211122",
"day_weather_code": "00",
"day_high_temperature": "4",
"day_weather": "晴",
"day_wind_power": "3-4级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西北风",
"night_low_temperature": "-4",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
}
]
}
}
天气查询-按地名id
根据地名查询对应的id。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| area | String | 是 | 地名 |
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "30853523396532582768", // 本次请求号
"data": {
"count": 14, // 查询结果个数
"areaList": [ // 查询结果
{
"area": "杭州", // 地名
"areaId": "101210101", // 地名id
"city": "杭州", // 城市
"province": "浙江" // 省份
},
{
"area": "萧山",
"areaId": "101210102",
"city": "杭州",
"province": "浙江"
},
{
"area": "桐庐",
"areaId": "101210103",
"city": "杭州",
"province": "浙江"
},
{
"area": "淳安",
"areaId": "101210104",
"city": "杭州",
"province": "浙江"
},
{
"area": "建德",
"areaId": "101210105",
"city": "杭州",
"province": "浙江"
},
{
"area": "余杭",
"areaId": "101210106",
"city": "杭州",
"province": "浙江"
},
{
"area": "临安",
"areaId": "101210107",
"city": "杭州",
"province": "浙江"
},
{
"area": "富阳",
"areaId": "101210108",
"city": "杭州",
"province": "浙江"
},
{
"area": "上城",
"areaId": "101210109",
"city": "杭州",
"province": "浙江"
},
{
"area": "下城",
"areaId": "101210110",
"city": "杭州",
"province": "浙江"
},
{
"area": "江干",
"areaId": "101210111",
"city": "杭州",
"province": "浙江"
},
{
"area": "拱墅",
"areaId": "101210112",
"city": "杭州",
"province": "浙江"
},
{
"area": "西湖",
"areaId": "101210113",
"city": "杭州",
"province": "浙江"
},
{
"area": "滨江",
"areaId": "101210114",
"city": "杭州",
"province": "浙江"
}
]
}
}
天气查询-按景区id
根据景点名称查询景点id。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| scenery | String | 是 | 景点名称 |
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "30853523396532582768", // 本次请求号
"data": {
"count": 2, // 查询结果个数
"sceneryList": [ // 查询结果
{
"name": "故宫博物院-北京市景点",
"id": "10101010018A"
},
{
"name": "沈阳故宫-辽宁省景点",
"id": "10107010109A"
}
]
}
}
天气查询-24小时
根据地名查询24小时的天气。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| area | String | 否 | 地名,详见地名说明 |
| areaId | String | 否 | 地名Id,详见地名说明 |
地名说明
- area和areaId必须传入一个,同时传入,以areaId为准
- 地名不能带有“市”、“县”,比如查杭州,area传入“杭州”,而不是传入“杭州市”
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "30853523396532582768", // 本次请求号
"data": {
"area": "北京", // 地名 详见 地名说明
"areaId": "101010100", // 地名id 详见 地名说明
"province": "北京", // 省份
"city": "北京", // 城市
"hourWeathers": [ // 24 小时天气, 共24个元素,按时间从早到晚排序
{
"time": "202111160800", // 时间
"weather": "阴", // 天气
"weather_code": "02", // 天气编号,详见天气编号
"temperature": "13", // 温度
"wind_direction": "东风", // 风向
"wind_power": "0-3级" // 风级
},
{
"time": "202111160900",
"temperature": "14",
"weather": "阴",
"wind_direction": "东风",
"weather_code": "02",
"wind_power": "0-3级"
},
{
"temperature": "15",
"weather": "阴",
"wind_direction": "东风",
"time": "202111161000",
"weather_code": "02",
"wind_power": "0-3级"
},
...
]
}
}
天气查询-未来7天内指定日期
根据地名查询未来7天内指定日期的天气。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| area | String | 否 | 地名,详见地名说明 |
| areaId | String | 否 | 地名Id,详见地名说明 |
| date | String | 否 | 日期,格式:yyyyMMdd,默认今天 |
地名说明
- area和areaId必须传入一个,同时传入,以areaId为准
- 地名不能带有“市”、“县”,比如查杭州,area传入“杭州”,而不是传入“杭州市”
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "30853523396532582768", // 本次请求号
"data": {
"area": "北京", // 地名 详见 地名说明
"areaId": "101010100", // 地名id 详见 地名说明
"province": "北京", // 省份
"city": "北京", // 城市
"weather": { // 天气
"date": "20211118", // 日期
"day_weather": "多云",
"day_weather": "晴", // 白天天气
"day_weather_code": "00", // 白天天气编号,详见天气编号
"day_weather_pic": "xxxx/weather-icon/d00.png", // 白天天气图标
"day_high_temperature": "12", // 白天最高温度
"day_wind_direction": "西南风", // 白天风向
"day_wind_power": "<3级", // 白天风级
"night_weather": "多云", // 夜间天气
"night_weather_code": "01", // 夜间天气编号
"night_weather_pic": "xxxx/weather-icon/n01.png", // 夜间天气图标
"night_low_temperature": "1", // 夜间最低温度
"night_wind_direction": "西南风", // 夜间风向
"night_wind_power": "<3级", // 夜间风级
"sun_begin_end": "06:27|17:01", // 太阳升起和落下时间
"life": { //生活气象指数
"uv": { // 紫外线
"title": "弱",
"desc": "辐射较弱,涂擦SPF12-15、PA+护肤品。"
},
"aqi": { // 空气质量
"title": "良",
"desc": "气象条件有利于空气污染物扩散。"
},
"clothes": { // 着装
"title": "较冷",
"desc": "建议着厚外套加毛衣等服装。"
},
"wash_car": { // 出行
"title": "较不宜",
"desc": "路面有积水,车子易被溅上泥水。"
}
}
}
}
}
天气查询-未来15天
根据地名查询未来15天的天气。
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| area | String | 否 | 地名,详见地名说明 |
| areaId | String | 否 | 地名Id,详见地名说明 |
地名说明
- area和areaId必须传入一个,同时传入,以areaId为准
- 地名不能带有“市”、“县”,比如查杭州,area传入“杭州”,而不是传入“杭州市”
返回样例
{
"code": 200, // 详见code返回码说明
"msg": "成功", // code 对应的描述
"taskNo": "51168811490923554212", // 本次请求号
"data": {
"area": "北京", // 地名 详见 地名说明
"areaId": "101010100", // 地名id 详见 地名说明
"province": "北京", // 省份
"city": "北京", // 城市
"dayWeathers": [ // 未来15天天气,按日期从早到晚排序
{
"daytime": "20211116", // 日期
"day_weather": "晴", // 白天天气
"day_weather_code": "00", // 白天天气编号,详见天气编号
"day_weather_pic": "xxxx/weather-icon/d00.png", // 白天天气图标
"day_high_temperature": "12", // 白天最高温度
"day_wind_direction": "西南风", // 白天风向
"day_wind_power": "<3级", // 白天风级
"night_weather": "多云", // 夜间天气
"night_weather_code": "01", // 夜间天气编号
"night_weather_pic": "xxxx/weather-icon/n01.png", // 夜间天气图标
"night_low_temperature": "1", // 夜间最低温度
"night_wind_direction": "西南风", // 夜间风向
"night_wind_power": "<3级" // 夜间风级
},
{
"daytime": "20211117",
"day_weather_code": "00",
"day_high_temperature": "13",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "西南风",
"night_wind_power": "<3级",
"night_low_temperature": "0",
"night_wind_direction": "西南风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴"
},
{
"daytime": "20211118",
"day_weather_code": "00",
"day_high_temperature": "12",
"day_weather": "晴",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d00.png",
"day_wind_direction": "南风",
"night_low_temperature": "2",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "<3级"
},
{
"daytime": "20211119",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "3",
"night_wind_direction": "北风",
"night_weather_pic": "xxxx/weather-icon/n01.png",
"night_weather_code": "01",
"night_weather": "多云",
"night_wind_power": "<3级"
},
{
"daytime": "20211120",
"day_weather_code": "01",
"day_high_temperature": "10",
"day_weather": "多云",
"day_wind_power": "<3级",
"day_weather_pic": "xxxx/weather-icon/d01.png",
"day_wind_direction": "北风",
"night_low_temperature": "1",
"night_wind_direction": "西北风",
"night_weather_pic": "xxxx/weather-icon/n00.png",
"night_weather_code": "00",
"night_weather": "晴",
"night_wind_power": "3-4级"
},
....
]
}
}
天气查询-历史天气
全国3000多个省市的历史天气查询,包括最高最低温度、风级、湿度、气压等指数,最低最高温度、日出日落时间、空气质量指数、首要污染物等信息.
请求说明
| 名称 | 类型 | 必须 | 说明 |
|---|---|---|---|
| date | String | 否 | 日期,默认为昨天,格式为:yyyy-MM-dd |
| city | String | 是 | 城市名称或者城市区划代码,支持区县 |
返回样例
{
"code": 200,//返回码,详见返回码说明
"msg": "成功",//返回码对应描述
"taskNo": "680024790172821701729765",//本次请求号
"data": {
"date": "2024-08-23",//日期
"templow": "26",//最低气温
"img": "https://xxx.png",//图片地址
"imgNo": "02",//天气图标编号
"sunrise": "05:30",//日出时间
"windpower": "2级",//风级
"cityname": "杭州",//城市
"cityid": 382,//城市ID
"pressure": "1004",//气压
"primarypollutant": "—",//首要污染物
"temphigh": "36",//最高气温
"winddirect": "南风",//风向
"sunset": "18:33",//日落时间
"weather": "晴",//天气
"aqi": "35",//AQI指数
"humidity": "80",//湿度
"windspeed": "2.1"//风速
}
}
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)