一、接口介绍
通过坐标区域、IP、地名、景点名称、电话区号或邮编等有效信息可查询天气情况(天气状况、湿度、天气图标、实时温度、风向、风级、紫外线、穿衣指南、空气指数)。可查询到当前天气、未来24小时、7天、15天、40天内天气预报和过往的历史天气情况等数据,广泛应用于能源、电力、农业、生活服务类应用、智能硬件、航天航海、旅游业、建筑业等领域。
二、使用案例截图
三、API文档
当前天气查询
3.1地名-->查询天气
3.1.1接入点说明:
根据地名,获取地名对应的区域ID,再根据区域ID取得天气情况。如果存在多个相同的地名,会选取第一条(数据库中默认的区域ID的排序顺序取第一条)区域信息作为前提条件来查询天气。
3.1.2接口地址:
http[s]://route.showapi.com/92?showapi_appid=替换自己的值&showapi_sign=替换自己的值。
3.1.3更新频率:
实时天气和恶劣天气预警30分钟更新一次,f1f7预报数据一天更新3次,7:30、12:00、18:00更新从当天起往后7天的预报数据。
3.1.4返回格式:
json
3.1.5请求参数
3.1.6返回参数
3.1.7请求代码示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapipublic/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/92","showapi_appid","showapi_sign")
.addTextPara("areaCode","530700")
.addTextPara("areaid","101291401")
.addTextPara("area","丽江")
.addTextPara("needMoreDay","0")
.addTextPara("needIndex","0")
.addTextPara("need3HourForcast","0")
.addTextPara("needAlarm","0")
.addTextPara("needHourData","")
.post();
System.out.println(res);
3.2 IP-->查询天气
3.2.1接入点说明:
通过IP地址获取IP对应的区域信息,再根据区域信息获取对应的天气情况。
3.2.2接口地址:
http[s]://route.showapi.com/94?showapi_appid=替换自己的值&showapi_sign=替换自己的值
3.2.3更新频率:
实时天气和恶劣天气预警30分钟更新一次,f1f7预报数据一天更新3次,7:30、12:00、18:00更新从当天起往后7天的预报数据
3.2.4返回格式:
json
3.2.5请求参数
3.2.6返回参数
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
time | String | 201203061100 | 预报发布时间 |
cityInfo | Object[] | 查询的地区基本资料 | |
c1 | String | 101010100 | 区域id |
c2 | String | beijing | 城市英文名 |
c3 | String | 北京 | 城市中文名 |
c4 | String | beijing | 城市所在市英文名 |
c5 | String | 北京 | 城市所在市中文名 |
c6 | String | beijing | 城市所在省英文名 |
c7 | String | 北京 | 城市所在省中文名 |
c8 | String | china | 城市所在国家英文名 |
c9 | String | 中国 | 城市所在国家中文名 |
c10 | String | 1 | 城市级别 |
c11 | String | 010 | 城市区号 |
c12 | String | 100000 | 邮编 |
longitude | String | 116.391 | 经度 |
latitude | String | 39.904 | 纬度 |
c15 | String | 33 | 海拔 |
c16 | String | AZ9010 | 雷达站号 |
c17 | String | +8 | 时区 |
c0 | String | 110114 | 地区code |
f1 | Object[] | 今天的天气预报 | |
day_weather | String | 多云 | 白天天气 |
night_weather | String | 暴雨 | 晚上天气 |
day_air_temperature | String | 26 | 白天天气温度(摄氏度) |
night_air_temperature | String | 12 | 晚上天气温度(摄氏度) |
day_wind_direction | String | 东北风 | 白天风向编号 |
night_wind_direction | String | 西北风 | 晚上风向编号 |
day_wind_power | String | 34级10~17m/h | 白天风力编号 |
night_wind_power | String | 微风<10m/h | 晚上风力编号 |
sun_begin_end | String | 06:44|18:21 | 日出日落时间(中间用|分割) |
index | Object[] | 指数对象 | |
beauty | String | 化妆指数 | |
clothes | String | 穿衣指数 | |
cold | String | 感冒 | |
comfort | String | 舒适 | |
glass | String | 太阳镜 | |
sports | String | 运动 | |
travel | String | 旅游 | |
uv | String | 紫外线 | |
wash_car | String | 洗车 | |
aqi | String | 大气污染 | |
ac | String | 空调控制 | |
ag | String | 过敏指数 | |
cl | String | 晨练指数 | |
dy | String | 钓鱼指数 | |
gj | String | 逛街指数 | |
hc | String | 划船指数 | |
ls | String | 晾晒指数 | |
mf | String | 美发指数 | |
nl | String | 夜生活指数 | |
pj | String | 啤酒指数 | |
pk | String | 放风筝指数 | |
yh | String | 约会指数 | |
zs | String | 中暑指数 | |
xq | String | 心情指数 | |
day | String | 20150627 | 当前天 |
weekday | Number | 6 | 星期几 |
day_weather_pic | String | 白天天气图标 | |
night_weather_pic | String | 晚上天气图标 | |
day_weather_code | String | 01 | 白天的天气编码 |
night_weather_code | String | 02 | 晚上的天气编码 |
air_press | String | 大气压 | |
jiangshui | String | 降水概率 | |
ziwaixian | String | 紫外线 | |
f2 | String | 今天+1天的天气预报 | |
f3 | String | 今天+2天的天气预报 | |
f4 | String | 今天+3天的天气预报 | |
f5 | String | 今天+4天的天气预报 | |
f6 | String | 今天+5天的天气预报 | |
f7 | String | 今天+6天的天气预报 | |
now | Object[] | 现在实时的天气情况 | |
aqi | String | 65 | 空气指数,越小越好 |
sd | String | 56% | 空气湿度 |
temperature | String | 26 | 气温 |
temperature_time | String | 15:00 | 获得气温的时间 |
weather | String | 阴 | 天气 |
weather_pic | String | http://appimg.showapi.com/images/weather/icon/day/02.png | 天气小图标 |
wind_direction | String | 南风 | 风向 |
wind_power | String | 1级 | 风力 |
aqiDetail | Object[] | aqi明细数据 | |
aqi | String | 38 | 空气质量指数,越小越好 |
area | String | 昆明 | 地区 |
co | String | 0.713 | 一氧化碳1小时平均,mg/m3 |
no2 | String | 12 | 二氧化氮1小时平均,μg/m3 |
o3 | String | 104 | 臭氧1小时平均,μg/m3 |
o3_8h | String | 52 | 臭氧8小时平均,μg/m3 |
pm10 | String | 37 | 颗粒物(粒径小于等于10μm)1小时平均,μg/m3 |
pm2_5 | String | 19 | 颗粒物(粒径小于等于2.5μm)1小时平均,μg/m3 |
primary_pollutant | String | 颗粒物(PM2.5) | 首要污染物 |
quality | String | 优 | 空气质量指数类别,有“优质、良好、轻度污染、中度污染、重度污染、严重污染”6类 |
so2 | String | 13 | 二氧化硫1小时平均,μg/m3 |
num | String | 12 | 排名。越小越好 |
rain | String | 降水量(mm) | |
hourDataList | Object[] | 每半小时数据的累积数组。当天0点清空重新累积。 | |
ret_code | Number | 0 | 0为成功,其他失败 |
3.2.7请求代码示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-4","showapi_appid","showapi_sign")
.addTextPara("ip","113.78.19.201")
.addTextPara("needMoreDay","0")
.addTextPara("needIndex","0")
.addTextPara("needHourData","0")
.addTextPara("need3HourForcast","0")
.addTextPara("needAlarm","0")
.post();
System.out.println(res);
3.3坐标-->查询天气
3.3.1接入点说明:
通过坐标查询对应坐标区域信息,再根据区域查询对应的天气情况。使用场景:手机端通过gps定位查询天气
3.3.2接口地址:
http[s]://route.showapi.com/9-5?showapi_appid=替换自己的值&showapi_sign=替换自己的值
3.3.3返回格式:
json
3.3.4更新频率:
实时天气和恶劣天气预警30分钟更新一次,f1-f7预报数据一天更新3次,7:30、12:00、18:00更新从当天起往后7天的预报数据
3.3.6请求参数
参数名称 | 类型 | 示例值 | 必须 | 描述 |
---|---|---|---|---|
from | String | 5 | 是 | 输入的坐标类型: |
lng | String | 116.2278 | 是 | 经度值 |
lat | String | 40.242266 | 是 | 纬度值 |
needMoreDay | String | 0 | 否 | 是否需要返回7天数据中的后4天。1为返回,0为不返回。 |
needIndex | String | 0 | 否 | 是否需要返回指数数据,比如穿衣指数、紫外线指数等。1为返回,0为不返回。 |
needHourData | String | 0 | 否 | 是否需要每小时数据的累积数组。由于本系统是半小时刷一次实时状态, 因此实时数组最大长度为48。每天0点长度初始化为0. |
need3HourForcast | String | 0 | 否 | 是否需要当天每3/6/8小时一次的天气预报列表。1为需要,0为不需要。注意f1是3小时间隔,但f2到f7的间隔可能是6或8小时。 |
needAlarm | String | 0 | 否 | 是否需要天气预警。1为需要,0为不需要。 |
3.3.7返回参数
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
time | String | 201203061100 | 预报发布时间 |
cityInfo | Object[] | 查询的地区基本资料 | |
- c1 | String | 101010100 | 区域id |
- c2 | String | beijing | 城市英文名 |
- c3 | String | 北京 | 城市中文名 |
- c4 | String | beijing | 城市所在市英文名 |
- c5 | String | 北京 | 城市所在市中文名 |
- c6 | String | beijing | 城市所在省英文名 |
- c7 | String | 北京 | 城市所在省中文名 |
- c8 | String | china | 城市所在国家英文名 |
- c9 | String | 中国 | 城市所在国家中文名 |
- c10 | String | 1 | 城市级别 |
- c11 | String | 010 | 城市区号 |
- c12 | String | 100000 | 邮编 |
- longitude | String | 116.391 | 经度 |
- latitude | String | 39.904 | 纬度 |
- c15 | String | 33 | 海拔 |
- c16 | String | AZ9010 | 雷达站号 |
- c17 | String | +8 | 时区 |
- c0 | String | 110000 | 地区code |
f1 | Object[] | 今天的天气预报 | |
- day_weather | String | 多云 | 白天天气 |
- night_weather | String | 暴雨 | 晚上天气 |
- day_air_temperature | String | 26 | 白天天气温度(摄氏度) |
- night_air_temperature | String | 12 | 晚上天气温度(摄氏度) |
- day_wind_direction | String | 东北风 | 白天风向编号 |
- night_wind_direction | String | 西北风 | 晚上风向编号 |
- day_wind_power | String | 3-4级10~17m/h | 白天风力编号 |
- night_wind_power | String | 微风<10m/h | 晚上风力编号 |
- sun_begin_end | String | 06:44|18:21 | 日出日落时间(中间用|分割) |
- index | Object[] | 指数对象 | |
- beauty | String | 化妆指数 | |
- clothes | String | 穿衣指数 | |
- cold | String | 感冒 | |
- comfort | String | 舒适 | |
- glass | String | 太阳镜 | |
- sports | String | 运动 | |
- travel | String | 旅游 | |
- uv | String | 紫外线 | |
- wash_car | String | 洗车 | |
- aqi | String | 大气污染 | |
- ac | String | 空调控制 | |
- ag | String | 过敏指数 | |
- cl | String | 晨练指数 | |
- dy | String | 钓鱼指数 | |
- gj | String | 逛街指数 | |
- hc | String | 划船指数 | |
- ls | String | 晾晒指数 | |
- mf | String | 美发指数 | |
- nl | String | 夜生活指数 | |
- pj | String | 啤酒指数 | |
- pk | String | 放风筝指数 | |
- yh | String | 约会指数 | |
- zs | String | 中暑指数 | |
- xq | String | 心情指数 | |
- day | String | 20150627 | 当前天 |
- weekday | Number | 6 | 星期几 |
- day_weather_pic | String | 白天天气图标 | |
- night_weather_pic | String | 晚上天气图标 | |
- day_weather_code | String | 01 | 白天的天气编码 |
- night_weather_code | String | 02 | 晚上的天气编码 |
- air_press | String | 大气压 | |
- jiangshui | String | 降水概率 | |
- 3hourForcast | Object[] | 3小时预报 | |
- 0 | Object | ||
- precip | String | 0.0 | 降水(mm) |
- wind_direction | String | 西风 | 风向 |
- wind_power | String | <3级 | 风力 |
- temperature_max | String | 14 | |
- weather | String | 晴 | |
- weather_pic | String | http://app1.showapi.com/weather/icon/day/00.png | |
- hour | String | 8时-11时 | |
- temperature_min | String | 6 | |
- temperature | String | 6 | |
- ziwaixian | String | 紫外线 | |
f2 | String | 今天+1天的天气预报 | |
f3 | String | 今天+2天的天气预报 | |
f4 | String | 今天+3天的天气预报 | |
f5 | String | 今天+4天的天气预报 | |
f6 | String | 今天+5天的天气预报 | |
f7 | String | 今天+6天的天气预报 | |
now | Object[] | 现在实时的天气情况 | |
- aqi | String | 65 | 空气指数,越小越好 |
- sd | String | 56% | 空气湿度 |
- temperature | String | 26 | 气温 |
- temperature_time | String | 15:00 | 获得气温的时间 |
- weather | String | 阴 | 天气 |
- weather_pic | String | http://appimg.showapi.com/images/weather/icon/day/02.png | 天气小图标 |
- wind_direction | String | 南风 | 风向 |
- wind_power | String | 1级 | 风力 |
- aqiDetail | Object[] | aqi明细数据 | |
- aqi | String | 38 | 空气质量指数,越小越好 |
- area | String | 昆明 | 地区 |
- co | String | 0.713 | 一氧化碳1小时平均,mg/m3 |
- no2 | String | 12 | 二氧化氮1小时平均,μg/m3 |
- o3 | String | 104 | 臭氧1小时平均,μg/m3 |
- o3_8h | String | 52 | 臭氧8小时平均,μg/m3 |
- pm10 | String | 37 | 颗粒物(粒径小于等于10μm)1小时平均,μg/m3 |
- pm2_5 | String | 19 | 颗粒物(粒径小于等于2.5μm)1小时平均,μg/m3 |
- primary_pollutant | String | 颗粒物(PM2.5) | 首要污染物 |
- quality | String | 优 | 空气质量指数类别,有“优质、良好、轻度污染、中度污染、重度污染、严重污染”6类 |
- so2 | String | 13 | 二氧化硫1小时平均,μg/m3 |
- num | String | 12 | 排名。越小越好 |
- rain | String | 0.1 | 降水量(mm) |
hourDataList | Object[] | 每半小时数据的累积数组。当天0点清空重新累积。 | |
ret_code | Number | 0 | 0为成功,其他失败 |
3.3.8请求代码示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-5","showapi_appid","showapi_sign")
.addTextPara("from","5")
.addTextPara("lng","116.2278")
.addTextPara("lat","40.242266")
.addTextPara("needMoreDay","0")
.addTextPara("needIndex","0")
.addTextPara("needHourData","0")
.addTextPara("need3HourForcast","0")
.addTextPara("needAlarm","0")
.post();
System.out.println(res);
3.4区号邮编-->查询天气
3.4.1接入点说明:
使用电话区号或邮编查询天气
3.4.2接口地址:
http[s]://route.showapi.com/9-10?showapi_appid=替换自己的值&showapi_sign=替换自己的值
3.4.3返回格式:
json
3.4.4更新频率:
实时天气和恶劣天气预警30分钟更新一次,f1-f7预报数据一天更新3次,7:30、12:00、18:00更新从当天起往后7天的预报数据
3.5.6请求参数
参数名称 | 类型 | 示例值 | 必须 | 描述 |
---|---|---|---|---|
post_code | String | 200000 | 否 | 邮编,比如上海200000 |
phone_code | String | 021 | 否 | 电话区号,比如上海021。 注意邮编和区号必须二选一输入。都输入时,以邮编为准。 |
needMoreDay | String | 0 | 否 | 是否需要返回7天数据中的后4天。1为返回,0为不返回。 |
needIndex | String | 0 | 否 | 是否需要返回指数数据,比如穿衣指数、紫外线指数等。1为返回,0为不返回。 |
needHourData | String | 0 | 否 | 是否需要每小时数据的累积数组。由于本系统是半小时刷一次实时状态,因此实时数组最大长度为48。每天0点长度初始化为0. 1为需要 0为不 |
need3HourForcast | String | 0 | 否 | 是否需要当天每3/6小时一次的天气预报列表。1为需要,0为不需要。 |
needAlarm | String | 0 | 否 | 是否需要天气预警。1为需要,0为不需要。 |
3.6.7返回参数
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
time | String | 预报发布时间 | |
cityInfo | Object[] | 查询的地区基本资料 | |
- c1 | String | 101010100 | 区域id |
- c2 | String | beijing | 城市英文名 |
- c3 | String | 北京 | 城市中文名 |
- c4 | String | beijing | 城市所在市英文名 |
- c5 | String | 北京 | 城市所在市中文名 |
- c6 | String | beijing | 城市所在省英文名 |
- c7 | String | 北京 | 城市所在省中文名 |
- c8 | String | china | 城市所在国家英文名 |
- c9 | String | 中国 | 城市所在国家中文名 |
- c10 | String | 1 | 城市级别 |
- c11 | String | 010 | 城市区号 |
- c12 | String | 100000 | 邮编 |
- longitude | String | 116.391 | 经度 |
- latitude | String | 39.904 | 纬度 |
- c15 | String | 33 | 海拔 |
- c16 | String | AZ9010 | 雷达站号 |
- c17 | String | +8 | 时区 |
- c0 | String | 110114 | 地区code |
f1 | Object[] | 今天的天气预报 | |
- day_weather | String | 多云 | 白天天气 |
- night_weather | String | 暴雨 | 晚上天气 |
- day_air_temperature | String | 26 | 白天天气温度(摄氏度) |
- night_air_temperature | String | 12 | 晚上天气温度(摄氏度) |
- day_wind_direction | String | 东北风 | 白天风向编号 |
- night_wind_direction | String | 西北风 | 晚上风向编号 |
- day_wind_power | String | 3-4级10~17m/h | 白天风力编号 |
- night_wind_power | String | 微风<10m/h | 晚上风力编号 |
- sun_begin_end | String | 06:44|18:21 | 日出日落时间(中间用|分割) |
- index | Object[] | 指数对象 | |
- beauty | String | 化妆指数 | |
- clothes | String | 穿衣指数 | |
- cold | String | 感冒 | |
- comfort | String | 舒适 | |
- glass | String | 太阳镜 | |
- sports | String | 运动 | |
- travel | String | 旅游 | |
- uv | String | 紫外线 | |
- wash_car | String | 洗车 | |
- aqi | String | 大气污染 | |
- ac | String | 空调控制 | |
- ag | String | 过敏指数 | |
- cl | String | 晨练指数 | |
- dy | String | 钓鱼指数 | |
- gj | String | 逛街指数 | |
- hc | String | 划船指数 | |
- ls | String | 晾晒指数 | |
- mf | String | 美发指数 | |
- nl | String | 夜生活指数 | |
- pj | String | 啤酒指数 | |
- pk | String | 放风筝指数 | |
- yh | String | 约会指数 | |
- zs | String | 中暑指数 | |
- xq | String | 心情指数 | |
- day | String | 20150627 | 当前天 |
- weekday | Number | 6 | 星期几 |
- day_weather_pic | String | 白天天气图标 | |
- night_weather_pic | String | 晚上天气图标 | |
- day_weather_code | String | 01 | 白天的天气编码 |
- night_weather_code | String | 02 | 晚上的天气编码 |
- air_press | String | 大气压 | |
- jiangshui | String | 降水概率 | |
- ziwaixian | String | 紫外线 | |
f2 | String | 今天+1天的天气预报 | |
f3 | String | 今天+2天的天气预报 | |
f4 | String | 今天+3天的天气预报 | |
f5 | String | 今天+4天的天气预报 | |
f6 | String | 今天+5天的天气预报 | |
f7 | String | 今天+6天的天气预报 | |
now | Object[] | 现在实时的天气情况 | |
- aqi | String | 65 | 空气指数,越小越好 |
- sd | String | 56% | 空气湿度 |
- temperature | String | 26 | 气温 |
- temperature_time | String | 15:00 | 获得气温的时间 |
- weather | String | 阴 | 天气 |
- weather_pic | String | http://appimg.showapi.com/images/weather/icon/day/02.png | 天气小图标 |
- wind_direction | String | 南风 | 风向 |
- wind_power | String | 1级 | 风力 |
- aqiDetail | Object[] | aqi明细数据 | |
- aqi | String | 38 | 空气质量指数,越小越好 |
- area | String | 昆明 | 地区 |
- co | String | 0.713 | 一氧化碳1小时平均,mg/m3 |
- no2 | String | 12 | 二氧化氮1小时平均,μg/m3 |
- o3 | String | 104 | 臭氧1小时平均,μg/m3 |
- o3_8h | String | 52 | 臭氧8小时平均,μg/m3 |
- pm10 | String | 37 | 颗粒物(粒径小于等于10μm)1小时平均,μg/m3 |
- pm2_5 | String | 19 | 颗粒物(粒径小于等于2.5μm)1小时平均,μg/m3 |
- primary_pollutant | String | 颗粒物(PM2.5) | 首要污染物 |
- quality | String | 优 | 空气质量指数类别,有“优质、良好、轻度污染、中度污染、重度污染、严重污染”6类 |
- so2 | String | 13 | 二氧化硫1小时平均,μg/m3 |
- num | String | 12 | 排名。越小越好 |
- rain | String | 降水量(mm) | |
hourDataList | String | 每半小时数据的累积数组。当天0点清空重新累积。 | |
ret_code | Number | 0 | 0为成功,其他失败 |
3.7.8请求代码示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-6","showapi_appid","showapi_sign")
.addTextPara("spotId","")
.addTextPara("area","泰山")
.addTextPara("needMoreDay","0")
.addTextPara("needIndex","0")
.addTextPara("needHourData","0")
.addTextPara("need3HourForcast","0")
.addTextPara("needAlarm","0")
.post();
System.out.println(res);
3.5景点名称-->查询天气
3.5.1接入点说明:
根据景点ID、景点名称来获取景点的天气情况。全国景点的id从这个接口获取[全国景点查询接口]
3.5.2接口地址:
http[s]://route.showapi.com/9-6?showapi_appid=替换自己的值&showapi_sign=替换自己的值
3.5.3返回格式:
json
3.5.4更新频率:
实时天气和恶劣天气预警30分钟更新一次,f1-f7预报数据一天更新3次,7:30、12:00、18:00更新从当天起往后7天的预报数据
3.5.5返回格式:
json
3.5.6请求参数
参数名称 | 类型 | 示例值 | 必须 | 描述 |
---|---|---|---|---|
spotId | String | 否 | 景点id。id取值为本平台中的 [全国景点查询接口] | |
area | String | 泰山 | 否 | 景点名称 |
needMoreDay | String | 0 | 否 | 是否需要返回7天数据中的后4天。1为返回,0为不返回。 |
needIndex | String | 0 | 否 | 是否需要返回指数数据,比如穿衣指数、紫外线指数等。1为返回,0为不返回。 |
needHourData | String | 0 | 否 | 是否需要每小时数据的累积数组。由于本系统是半小时刷一次实时状态,因此实时数组最大长度为48。每天0点长度初始化为0. 1为需要 0为不 |
need3HourForcast | String | 0 | 否 | 是否需要当天每3/6/8小时一次的天气预报列表。1为需要,0为不需要。注意f1是3小时间隔,但f2到f7的间隔可能是6或8小时。 |
needAlarm | String | 0 | 否 | 是否需要天气预警。1为需要,0为不需要。 |
3.5.7返回参数
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
time | String | 预报发布时间 | |
cityInfo | Object[] | 查询的地区基本资料 | |
- c1 | String | 101010100 | 区域id |
- c2 | String | beijing | 城市英文名 |
- c3 | String | 北京 | 城市中文名 |
- c4 | String | beijing | 城市所在市英文名 |
- c5 | String | 北京 | 城市所在市中文名 |
- c6 | String | beijing | 城市所在省英文名 |
- c7 | String | 北京 | 城市所在省中文名 |
- c8 | String | china | 城市所在国家英文名 |
- c9 | String | 中国 | 城市所在国家中文名 |
- c10 | String | 1 | 城市级别 |
- c11 | String | 010 | 城市区号 |
- c12 | String | 100000 | 邮编 |
- longitude | String | 116.391 | 经度 |
- latitude | String | 39.904 | 纬度 |
- c15 | String | 33 | 海拔 |
- c16 | String | AZ9010 | 雷达站号 |
- c17 | String | +8 | 时区 |
- c0 | String | 110114 | 地区code |
f1 | Object[] | 今天的天气预报 | |
- day_weather | String | 多云 | 白天天气 |
- night_weather | String | 暴雨 | 晚上天气 |
- day_air_temperature | String | 26 | 白天天气温度(摄氏度) |
- night_air_temperature | String | 12 | 晚上天气温度(摄氏度) |
- day_wind_direction | String | 东北风 | 白天风向编号 |
- night_wind_direction | String | 西北风 | 晚上风向编号 |
- day_wind_power | String | 3-4级10~17m/h | 白天风力编号 |
- night_wind_power | String | 微风<10m/h | 晚上风力编号 |
- sun_begin_end | String | 06:44|18:21 | 日出日落时间(中间用|分割) |
- index | Object[] | 指数对象 | |
- beauty | String | 化妆指数 | |
- clothes | String | 穿衣指数 | |
- cold | String | 感冒 | |
- comfort | String | 舒适 | |
- glass | String | 太阳镜 | |
- sports | String | 运动 | |
- travel | String | 旅游 | |
- uv | String | 紫外线 | |
- wash_car | String | 洗车 | |
- aqi | String | 大气污染 | |
- ac | String | 空调控制 | |
- ag | String | 过敏指数 | |
- cl | String | 晨练指数 | |
- dy | String | 钓鱼指数 | |
- gj | String | 逛街指数 | |
- hc | String | 划船指数 | |
- ls | String | 晾晒指数 | |
- mf | String | 美发指数 | |
- nl | String | 夜生活指数 | |
- pj | String | 啤酒指数 | |
- pk | String | 放风筝指数 | |
- yh | String | 约会指数 | |
- zs | String | 中暑指数 | |
- xq | String | 心情指数 | |
- day | String | 20150627 | 当前天 |
- weekday | Number | 6 | 星期几 |
- day_weather_pic | String | 白天天气图标 | |
- night_weather_pic | String | 晚上天气图标 | |
- day_weather_code | String | 01 | 白天的天气编码 |
- night_weather_code | String | 02 | 晚上的天气编码 |
- air_press | String | 大气压 | |
- jiangshui | String | 降水概率 | |
- ziwaixian | String | 紫外线 | |
f2 | String | 今天+1天的天气预报 | |
f3 | String | 今天+2天的天气预报 | |
f4 | String | 今天+3天的天气预报 | |
f5 | String | 今天+4天的天气预报 | |
f6 | String | 今天+5天的天气预报 | |
f7 | String | 今天+6天的天气预报 | |
now | Object[] | 现在实时的天气情况 | |
- aqi | String | 65 | 空气指数,越小越好 |
- sd | String | 56% | 空气湿度 |
- temperature | String | 26 | 气温 |
- temperature_time | String | 15:00 | 获得气温的时间 |
- weather | String | 阴 | 天气 |
- weather_pic | String | http://appimg.showapi.com/images/weather/icon/day/02.png | 天气小图标 |
- wind_direction | String | 南风 | 风向 |
- wind_power | String | 1级 | 风力 |
- aqiDetail | Object[] | aqi明细数据 | |
- aqi | String | 38 | 空气质量指数,越小越好 |
- area | String | 昆明 | 地区 |
- co | String | 0.713 | 一氧化碳1小时平均,mg/m3 |
- no2 | String | 12 | 二氧化氮1小时平均,μg/m3 |
- o3 | String | 104 | 臭氧1小时平均,μg/m3 |
- o3_8h | String | 52 | 臭氧8小时平均,μg/m3 |
- pm10 | String | 37 | 颗粒物(粒径小于等于10μm)1小时平均,μg/m3 |
- pm2_5 | String | 19 | 颗粒物(粒径小于等于2.5μm)1小时平均,μg/m3 |
- primary_pollutant | String | 颗粒物(PM2.5) | 首要污染物 |
- quality | String | 优 | 空气质量指数类别,有“优质、良好、轻度污染、中度污染、重度污染、严重污染”6类 |
- so2 | String | 13 | 二氧化硫1小时平均,μg/m3 |
- num | String | 12 | 排名。越小越好 |
- rain | String | 降水量(mm) | |
hourDataList | String | 每半小时数据的累积数组。当天0点清空重新累积。 | |
ret_code | Number | 0 | 0为成功,其他失败 |
3.5.8请求代码示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-6","showapi_appid","showapi_sign")
.addTextPara("spotId","")
.addTextPara("area","泰山")
.addTextPara("needMoreDay","0")
.addTextPara("needIndex","0")
.addTextPara("needHourData","0")
.addTextPara("need3HourForcast","0")
.addTextPara("needAlarm","0")
.post();
System.out.println(res);
3.6当前天气返回示例
{
"showapi_res_error": "",
"showapi_res_code": 0,
"showapi_res_id": "5fd9a6c68d57bae137f349d2",
"showapi_res_body": {
"ret_code": 0,
"time": "20201216120000",
"cityInfo": {
"c6": "yunnan",
"c5": "丽江",
"c4": "lijiang",
"c3": "丽江",
"c9": "中国",
"c8": "china",
"c7": "云南",
"c17": "+8",
"c16": "AZ9888",
"c1": "101291401",
"c2": "lijiang",
"c0": "530700",
"longitude": 100.222,
"c11": "0888",
"latitude": 26.903,
"c10": "2",
"c12": "674100",
"c15": "2394"
},
"now": {
"aqiDetail": {
"co": "0.8",
"num": "138",
"area": "丽江",
"so2": "6",
"o3": "76",
"no2": "12",
"quality": "优质",
"aqi": "50",
"pm10": "50",
"pm2_5": "17",
"o3_8h": "76",
"primary_pollutant": ""
},
"weather_code": "00",
"temperature_time": "14:00",
"wind_direction": "西南风",
"wind_power": "3级",
"sd": "15%",
"aqi": "50",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"rain": "0.0",
"temperature": "15"
},
"alarmList": [
{
"signalLevel": "蓝色",
"issueContent": "丽江市气象台12月14日11时30分发布大风蓝色预警:预计未来12小时,我市大部地区平均风力4~5级,局地阵风可达7级以上,容易造成树枝刮断,宣传牌吹落、轻质屋顶掀起、塑料大棚破损、水面小型船只倾覆和引发各类火灾等危害,请加强防范。(预警信息来源:国家预警信息发布中心)",
"issueTime": "2020-12-14 11:34:25",
"province": "云南省",
"signalType": "大风",
"city": "丽江市"
},
{
"signalLevel": "蓝色",
"issueContent": "云南省气象台2020年12月14日11时发布大风蓝色预警:预计未来12小时,迪庆、丽江、大理、楚雄、昆明、玉溪北部、红河北部、曲靖西部平均风力可达5到6级,阵风7到8级,请注意防范。(预警信息来源:国家预警信息发布中心)",
"province": "云南省",
"issueTime": "2020-12-14 11:04:57",
"signalType": "大风",
"city": ""
}
],
"showapi_fee_code": 0,
"f1": {
"night_weather_code": "00",
"day_weather": "晴",
"night_weather": "晴",
"index": {
"yh": {
"title": "较适宜",
"desc": "虽然有点风,不用担心天气来调皮捣乱而影响了兴致。"
},
"ls": {
"title": "适宜",
"desc": "天气不错,适宜晾晒。赶紧把久未见阳光的衣物搬出来吸收一下太阳的味道吧!"
},
"clothes": {
"title": "较冷",
"desc": "建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。"
},
"dy": {
"title": "较适宜",
"desc": "较适合垂钓,但风力稍大,会对垂钓产生一定的影响。"
},
"sports": {
"title": "较适宜",
"desc": "温较低,推荐您进行室内运动。"
},
"travel": {
"title": "适宜",
"desc": "天气较好,温度适宜,是个好天气哦。这样的天气适宜旅游,您可以尽情地享受大自然的风光。"
},
"beauty": {
"title": "防晒",
"desc": "温湿适宜,最好使用SPF20以上防晒霜打底,建议使用中性保湿型化妆品。"
},
"xq": {
"title": "好",
"desc": "天气较好,空气温润,和风飘飘,美好的天气会带来一天接踵而来的好心情。"
},
"hc": {
"title": "较适宜",
"desc": "气温低注意及时添衣,小心着凉。"
},
"zs": {
"title": "无中暑风险",
"desc": "天气舒适,令人神清气爽的一天,不用担心中暑的困扰。"
},
"cold": {
"title": "少发",
"desc": "各项气象条件适宜,无明显降温过程,发生感冒机率较低。"
},
"gj": {
"title": "适宜",
"desc": "天气较好,在这种天气里去逛街,既可畅快地放松身心,又会有很多意外收获,真是无比惬意。"
},
"comfort": {
"title": "较好",
"desc": "偏凉或凉,部分人感觉不舒适"
},
"uv": {
"title": "很强",
"desc": "紫外线辐射极强,建议涂擦SPF20以上、PA++的防晒护肤品,尽量避免暴露于日光下。"
},
"cl": {
"title": "适宜",
"desc": "天气不错,空气清新。"
},
"glass": {
"title": "必要",
"desc": "白天天气晴朗,太阳辐射较强,建议佩戴透射比1级且标注UV380-UV400的遮阳镜"
},
"aqi": {
"title": "良好",
"desc": "可以正常在户外活动,易敏感人群应减少外出"
},
"ac": {
"title": "较少开启",
"desc": "您将感到很舒适,一般不需要开启空调。"
},
"wash_car": {
"title": "较适宜",
"desc": "较适宜洗车,未来一天无雨,风力较小,擦洗一新的汽车至少能保持一天。"
},
"mf": {
"title": "一般",
"desc": "空气干燥,出门前要在头发上涂上含防晒和滋润成分的护发品,或备好遮阳帽、遮阳伞,以减轻太阳对头发的直接照射。"
},
"ag": {
"title": "极不易发",
"desc": "天气条件极不易诱发过敏。"
},
"pj": {
"title": "较不适宜",
"desc": "您将会感到有些凉意,建议饮用常温啤酒,并少量饮用为好。"
},
"nl": {
"title": "较适宜",
"desc": "天气较好,虽然有点风,比较适宜夜生活。"
},
"pk": {
"title": "适宜",
"desc": "天气不错,这种天气去放风筝既可以舒展筋骨,又可放松身心,超然自逸于广袤的天地之间。"
}
},
"jiangshui": "0%",
"air_press": "753.9hPa",
"night_wind_power": "0-3级 <5.4m/s",
"day_wind_power": "0-3级 <5.4m/s",
"day_weather_code": "00",
"3hourForcast": [
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "14",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"hour": "8时-11时",
"temperature_min": "6",
"temperature": "6"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "16",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"hour": "11时-14时",
"temperature_min": "6",
"temperature": "14"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "16",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"hour": "14时-17时",
"temperature_min": "14",
"temperature": "16"
},
{
"precip": "0.0",
"wind_direction": "西南风",
"wind_power": "<3级",
"temperature_max": "16",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"hour": "17时-20时",
"temperature_min": "11",
"temperature": "15"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "15",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"hour": "20时-23时",
"temperature_min": "8",
"temperature": "11"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "11",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"hour": "23时-2时",
"temperature_min": "3",
"temperature": "8"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "8",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"hour": "2时-5时",
"temperature_min": "3",
"temperature": "3"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "5",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"hour": "5时-8时",
"temperature_min": "3",
"temperature": "3"
}
],
"sun_begin_end": "08:00|18:28",
"ziwaixian": "很强",
"day_weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"weekday": 3,
"night_air_temperature": "2",
"day_wind_direction": "无持续风向",
"day_air_temperature": "17",
"night_wind_direction": "无持续风向",
"night_weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"day": "20201216"
},
"f3": {
"night_weather_code": "00",
"day_weather": "小雨",
"night_weather": "晴",
"index": {
"yh": {
"title": "较不适宜",
"desc": "室外有风,而且有降水,会给室外约会带来一些不便,如果外出约会,请一定做好准备。"
},
"ls": {
"title": "不宜",
"desc": "有降水,不适宜晾晒。若需要晾晒,请在室内准备出充足的空间。"
},
"clothes": {
"title": "较冷",
"desc": "建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。"
},
"dy": {
"title": "不宜",
"desc": "天气不好,有风,不适合垂钓。"
},
"sports": {
"title": "较不宜",
"desc": "有降水,推荐您在室内进行休闲运动。"
},
"travel": {
"title": "适宜",
"desc": "温度适宜,又有较弱降水和微风作伴,会给您的旅行带来意想不到的景象,适宜旅游,可不要错过机会呦!"
},
"beauty": {
"title": "保湿",
"desc": "皮肤易缺水,用润唇膏后再抹口红,用保湿型霜类化妆品。"
},
"xq": {
"title": "较差",
"desc": "有降水,雨水可能会使心绪无端地挂上轻愁,与其因下雨而无精打采,不如放松心情,好好欣赏一下雨景。你会发现雨中的世界是那般洁净温和、清新葱郁。"
},
"hc": {
"title": "不适宜",
"desc": "天气不好,建议选择别的娱乐方式。"
},
"zs": {
"title": "无中暑风险",
"desc": "天气不热,在炎炎夏日中十分难得,可以告别暑气漫漫啦~"
},
"cold": {
"title": "少发",
"desc": "各项气象条件适宜,无明显降温过程,发生感冒机率较低。"
},
"gj": {
"title": "较不宜",
"desc": "有降水,较不适宜逛街,若坚持出门,请带上雨具避免淋雨。"
},
"comfort": {
"title": "较好",
"desc": "偏凉或凉,部分人感觉不舒适"
},
"uv": {
"title": "最弱",
"desc": "属弱紫外线辐射天气,无需特别防护。若长期在户外,建议涂擦SPF在8-12之间的防晒护肤品。"
},
"cl": {
"title": "不宜",
"desc": "有较强降水,风力稍大,请避免户外晨练,建议在室内做适当锻炼,保持身体健康。"
},
"glass": {
"title": "不需要",
"desc": "白天有降水天气,视线较差,不需要佩戴太阳镜"
},
"aqi": {
"title": "良好",
"desc": "可以正常在户外活动,易敏感人群应减少外出"
},
"ac": {
"title": "较少开启",
"desc": "您将感到很舒适,一般不需要开启空调。"
},
"wash_car": {
"title": "不宜",
"desc": "不宜洗车,未来24小时内有雨,如果在此期间洗车,雨水和路上的泥水可能会再次弄脏您的爱车。"
},
"mf": {
"title": "适宜",
"desc": "洗发后最好用毛巾把头发吸干,若用吹风机,吹风前记得用适合干性发质的护发素,吹风时保持10cm距离,风的温度不要太高。"
},
"ag": {
"title": "极不易发",
"desc": "天气条件极不易诱发过敏,有降水,出行注意携带雨具。"
},
"pj": {
"title": "较不适宜",
"desc": "您将会感到有些凉意,建议饮用常温啤酒,并少量饮用为好。"
},
"nl": {
"title": "较不适宜",
"desc": "有风,且有降水,会给您的出行带来很大的不便,建议就近或最好在室内进行夜生活。"
},
"pk": {
"title": "不宜",
"desc": "天气不好,不适宜放风筝。"
}
},
"jiangshui": "88%",
"air_press": "752.7hPa",
"night_wind_power": "0-3级 <5.4m/s",
"day_wind_power": "0-3级 <5.4m/s",
"day_weather_code": "07",
"3hourForcast": [
{
"precip": "0.1",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "10",
"weather": "小雨",
"weather_pic": "http://app1.showapi.com/weather/icon/day/07.png",
"hour": "8时-11时",
"temperature_min": "2",
"temperature": "5"
},
{
"precip": "0.1",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "13",
"weather": "小雨",
"weather_pic": "http://app1.showapi.com/weather/icon/day/07.png",
"hour": "11时-14时",
"temperature_min": "5",
"temperature": "10"
},
{
"precip": "0.1",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "13",
"weather": "小雨",
"weather_pic": "http://app1.showapi.com/weather/icon/day/07.png",
"hour": "14时-17时",
"temperature_min": "10",
"temperature": "13"
},
{
"precip": "0.1",
"wind_direction": "西南风",
"wind_power": "<3级",
"temperature_max": "13",
"weather": "小雨",
"weather_pic": "http://app1.showapi.com/weather/icon/day/07.png",
"hour": "17时-20时",
"temperature_min": "6",
"temperature": "13"
},
{
"precip": "0.1",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "13",
"weather": "多云",
"weather_pic": "http://app1.showapi.com/weather/icon/night/01.png",
"hour": "20时-23时",
"temperature_min": "3",
"temperature": "6"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "6",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"hour": "23时-2时",
"temperature_min": "1",
"temperature": "3"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "3",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"hour": "2时-5时",
"temperature_min": "0",
"temperature": "1"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "1",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"hour": "5时-8时",
"temperature_min": "0",
"temperature": "0"
}
],
"sun_begin_end": "08:01|18:29",
"ziwaixian": "最弱",
"day_weather_pic": "http://app1.showapi.com/weather/icon/day/07.png",
"weekday": 5,
"night_air_temperature": "0",
"day_wind_direction": "无持续风向",
"day_air_temperature": "14",
"night_wind_direction": "无持续风向",
"night_weather_pic": "http://app1.showapi.com/weather/icon/night/00.png",
"day": "20201218"
},
"f2": {
"night_weather_code": "06",
"day_weather": "晴",
"night_weather": "雨夹雪",
"index": {
"yh": {
"title": "较适宜",
"desc": "虽然有点风,不用担心天气来调皮捣乱而影响了兴致。"
},
"ls": {
"title": "适宜",
"desc": "天气不错,适宜晾晒。赶紧把久未见阳光的衣物搬出来吸收一下太阳的味道吧!"
},
"clothes": {
"title": "较冷",
"desc": "建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。"
},
"dy": {
"title": "较适宜",
"desc": "较适合垂钓,但风力稍大,会对垂钓产生一定的影响。"
},
"sports": {
"title": "较适宜",
"desc": "温较低,推荐您进行室内运动。"
},
"travel": {
"title": "适宜",
"desc": "天气较好,温度适宜,是个好天气哦。这样的天气适宜旅游,您可以尽情地享受大自然的风光。"
},
"beauty": {
"title": "防晒",
"desc": "温湿适宜,最好使用SPF20以上防晒霜打底,建议使用中性保湿型化妆品。"
},
"xq": {
"title": "好",
"desc": "天气较好,空气温润,和风飘飘,美好的天气会带来一天接踵而来的好心情。"
},
"hc": {
"title": "较适宜",
"desc": "气温低注意及时添衣,小心着凉。"
},
"zs": {
"title": "无中暑风险",
"desc": "天气舒适,对易中暑人群来说非常友善。"
},
"cold": {
"title": "少发",
"desc": "各项气象条件适宜,无明显降温过程,发生感冒机率较低。"
},
"gj": {
"title": "适宜",
"desc": "天气较好,在这种天气里去逛街,既可畅快地放松身心,又会有很多意外收获,真是无比惬意。"
},
"comfort": {
"title": "较好",
"desc": "普遍感觉舒适"
},
"uv": {
"title": "很强",
"desc": "紫外线辐射极强,建议涂擦SPF20以上、PA++的防晒护肤品,尽量避免暴露于日光下。"
},
"cl": {
"title": "适宜",
"desc": "天气不错,空气清新。"
},
"glass": {
"title": "必要",
"desc": "白天天气晴朗,太阳辐射较强,建议佩戴透射比1级且标注UV380-UV400的遮阳镜"
},
"aqi": {
"title": "良好",
"desc": "可以正常在户外活动,易敏感人群应减少外出"
},
"ac": {
"title": "较少开启",
"desc": "您将感到很舒适,一般不需要开启空调。"
},
"wash_car": {
"title": "不宜",
"desc": "不宜洗车,未来24小时内有雪,如果在此期间洗车,雪水和路上的泥水可能会再次弄脏您的爱车。"
},
"mf": {
"title": "一般",
"desc": "空气干燥,出门前要在头发上涂上含防晒和滋润成分的护发品,或备好遮阳帽、遮阳伞,以减轻太阳对头发的直接照射。"
},
"ag": {
"title": "极不易发",
"desc": "天气条件极不易诱发过敏。"
},
"pj": {
"title": "较不适宜",
"desc": "您将会感到有些凉意,建议饮用常温啤酒,并少量饮用为好。"
},
"nl": {
"title": "较适宜",
"desc": "天气较好,虽然有点风,比较适宜夜生活。"
},
"pk": {
"title": "适宜",
"desc": "天气不错,这种天气去放风筝既可以舒展筋骨,又可放松身心,超然自逸于广袤的天地之间。"
}
},
"jiangshui": "0%",
"air_press": "752.8hPa",
"night_wind_power": "0-3级 <5.4m/s",
"day_wind_power": "0-3级 <5.4m/s",
"day_weather_code": "00",
"3hourForcast": [
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "12",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"hour": "8时-11时",
"temperature_min": "3",
"temperature": "5"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "14",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"hour": "11时-14时",
"temperature_min": "5",
"temperature": "12"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "14",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"hour": "14时-17时",
"temperature_min": "12",
"temperature": "14"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "14",
"weather": "晴",
"weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"hour": "17时-20时",
"temperature_min": "7",
"temperature": "13"
},
{
"precip": "0.0",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "13",
"weather": "小雨",
"weather_pic": "http://app1.showapi.com/weather/icon/night/07.png",
"hour": "20时-23时",
"temperature_min": "2",
"temperature": "7"
},
{
"precip": "0.1",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "7",
"weather": "雨夹雪",
"weather_pic": "http://app1.showapi.com/weather/icon/night/06.png",
"hour": "23时-2时",
"temperature_min": "2",
"temperature": "2"
},
{
"precip": "0.1",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "2",
"weather": "雨夹雪",
"weather_pic": "http://app1.showapi.com/weather/icon/night/06.png",
"hour": "2时-5时",
"temperature_min": "2",
"temperature": "2"
},
{
"precip": "0.1",
"wind_direction": "西风",
"wind_power": "<3级",
"temperature_max": "5",
"weather": "雨夹雪",
"weather_pic": "http://app1.showapi.com/weather/icon/night/06.png",
"hour": "5时-8时",
"temperature_min": "2",
"temperature": "2"
}
],
"sun_begin_end": "08:00|18:28",
"ziwaixian": "很强",
"day_weather_pic": "http://app1.showapi.com/weather/icon/day/00.png",
"weekday": 4,
"night_air_temperature": "2",
"day_air_temperature": "15",
"day_wind_direction": "无持续风向",
"day": "20201217",
"night_weather_pic": "http://app1.showapi.com/weather/icon/night/06.png",
"night_wind_direction": "无持续风向"
}
}
}
四、未来天气查询
4.1 id或名称-->查询24小时预报
4.1.1接入点说明:
根据区域ID和区域名,获取24小时的天气预报。区域名可能存在重名的情况,建议尽量使用区域ID来获取数据。需要说明的是24小时天气数据是每半小时更新一次
4.1.2接口地址:
http[s]://route.showapi.com/9-8?showapi_appid=替换自己的值&showapi_sign=替换自己的值
4.1.3返回格式:
Json
4.1.4更新频率:
每天更新3次,7:30,12:00, 18:00更新24小时预报
4.1.5请求参数
参数名称 | 类型 | 示例值 | 必须 | 描述 |
---|---|---|---|---|
areaCode | String | 530700 | 否 | 地区code. 此参数和areaid和area必须输入一个 |
areaid | String | 101291401 | 否 | 地区id. 此参数和areaCode和area必须输入一个(以后可能会废弃,请以areaCode为准) |
area | String | 丽江 | 否 | 地区名称 |
4.1.6返回参数
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
ret_code | Number | 0 | 0为成功,其他失败 |
area | String | 上海 | 查到的地区名 |
areaid | String | 101020100 | 查到的地区id |
hourList | Object[] | 24小时预报列表 | |
- 0 | Object | ||
- weather_code | String | 01 | 天气代号 |
- time | String | 201611061000 | 时间 |
- wind_direction | String | 东风 | 风向 |
- wind_power | String | 4-5级 8.0~10.7m/s | 风力 |
- weather | String | 多云 | 天气 |
- temperature | String | 21 | 气温 |
areaCode | String | 310000 | 查到的地区code |
4.1.7请求代码示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-8","showapi_appid","showapi_sign")
.addTextPara("areaCode","530700")
.addTextPara("areaid","101291401")
.addTextPara("area","丽江")
.post();
System.out.println(res);
4.1.8返回示例
{
"showapi_res_code": 0,
"showapi_res_error": "",
"showapi_res_id":"ce135f6739294c63be0c021b76b6fbff",
"showapi_res_body": {
"ret_code": 0,
"area": "上海",
"areaid": "101020100",
"areaCode":"310000",
"hourList": [
{
"weather_code": "01",
"time": "201611061000",
"wind_direction": "东风",
"wind_power": "4-5级 8.0~10.7m/s",
"weather": "多云",
"temperature": "21"
},
{
"weather_code": "01",
"time": "201611060900",
"wind_direction": "东风",
"wind_power": "3-4级 5.5~7.9m/s",
"weather": "多云",
"temperature": "19"
}
]
}
}
4.2 id或名称-->查未来15天预报
4.2.1接入点说明:
根据区域ID和区域名,获取当前日期至未来15天内的天气预报。因区域名可能存在重名的情况,建议尽量使用区域ID来获取数据。需要说明的是未来15天的天气数据是每天7点、12点、18点各更新一次
4.2.2接口地址:
http[s]://route.showapi.com/9-9?showapi_appid=替换自己的值&showapi_sign=替换自己的值
4.2.3返回格式:
Json
4.2.4更新频率:
每天更新3次,9:00,12:00, 19:00更新从当天起往后15天的预报数据
4.2.5请求参数
参数名称 | 类型 | 示例值 | 必须 | 描述 |
---|---|---|---|---|
areaCode | String | 530700 | 否 | 地区code. 此参数和areaid和area必须输入一个。 |
areaid | String | 101291401 | 否 | 地区id. 此参数和areaCode和area必须输入一个。(以后可能会废弃,以areaCode为准) |
area | String | 丽江 | 否 | 地区名称 |
4.2.6返回参数
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
ret_code | Number | 0 | |
area | String | 南安 | |
areaid | String | 101230506 | |
dayList | Object[] | ||
- 0 | Object | ||
- night_weather_code | String | 01 | 夜晚天气代号 |
- day_weather | String | 多云 | 白天天气 |
- night_weather | String | 多云 | 夜晚天气 |
- night_wind_power | String | 微风 | 夜晚风力 |
- day_wind_power | String | 微风 | 白天风力 |
- day_weather_code | String | 01 | 白天天气代号 |
- daytime | String | 20161106 | 日期 |
- day_weather_pic | String | http://appimg.showapi.com/images/weather/icon/day/01.png | 白天天气图片 |
- night_air_temperature | String | 21 | 夜晚气温 |
- day_air_temperature | String | 27 | 白天气温 |
- day_wind_direction | String | 无持续风向 | 白天风力 |
- night_weather_pic | String | http://appimg.showapi.com/images/weather/icon/night/01.png | 夜晚天气图片 |
- night_wind_direction | String | 北风 | 夜晚风力 |
areaCode | String | 350500 |
4.2.7请求代码示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-9","showapi_appid","showapi_sign")
.addTextPara("areaCode","530700")
.addTextPara("areaid","101291401")
.addTextPara("area","丽江")
.post();
System.out.println(res);
4.2.8返回示例
{
"showapi_res_code": 0,
"showapi_res_error": "",
"showapi_res_id":"ce135f6739294c63be0c021b76b6fbff",
"showapi_res_body": {
"ret_code": 0,
"area": "南安",
"areaid": "101230506",
"areaCode":"350500",
"dayList": [
{
"night_weather_code": "01",
"day_weather": "多云",
"night_weather": "多云",
"night_wind_power": "微风",
"day_wind_power": "微风",
"day_weather_code": "01",
"daytime": "20161106",
"day_weather_pic": "http://appimg.showapi.com/images/weather/icon/day/01.png",
"night_air_temperature": "21",
"day_air_temperature": "27",
"day_wind_direction": "无持续风向",
"night_weather_pic": "http://appimg.showapi.com/images/weather/icon/night/01.png",
"night_wind_direction": "北风"
},
{
"night_weather_code": "01",
"day_weather": "晴",
"night_weather": "多云",
"night_wind_power": "3-4级",
"day_wind_power": "微风",
"day_weather_code": "00",
"daytime": "20161107",
"day_weather_pic": "http://appimg.showapi.com/images/weather/icon/day/00.png",
"night_air_temperature": "21",
"day_air_temperature": "27",
"day_wind_direction": "无持续风向",
"night_weather_pic": "http://appimg.showapi.com/images/weather/icon/night/00.png",
"night_wind_direction": "北风"
}
]
}
}
4.3 id或名称-->查未来15天预报
4.3.1接入点说明:
根据区域ID和区域名,获取当前日期至未来40天内的天气预报。因区域名可能存在重名的情况,建议尽量使用区域ID来获取数据。需要说明的是未来15天的天气数据是每天7点、12点、18点各更新一次。
4.3.2接口地址:
http[s]://route.showapi.com/9-12?showapi_appid=替换自己的值&showapi_sign=替换自己的值
4.3.3返回格式:
json
4.3.4更新频率:
每天更新3次,9:00,12:00, 19:00更新从当天起往后40天的预报数据
4.3.5请求参数:
参数名称 | 类型 | 示例值 | 必须 | 描述 |
---|---|---|---|---|
areaCode | String | 530700 | 否 | 地区code. 此参数和areaid和area必须输入一个 |
areaid | String | 101291401 | 否 | 地区id. 此参数和areaCode和area必须输入一个(以后可能会废弃,以areaCode为准) |
area | String | 丽江 | 否 | 地区名称 |
4.3.6返回参数:
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
ret_code | Number | 0 | |
area | String | 南安 | |
areaid | String | 101230506 | |
day40List | Object[] | ||
- 0 | Object | ||
- night_weather_code | String | 01 | 夜晚天气代号 |
- day_weather | String | 多云 | 白天天气 |
- night_weather | String | 多云 | 夜晚天气 |
- night_wind_power | String | 微风 | 夜晚风力 |
- day_wind_power | String | 微风 | 白天风力 |
- day_weather_code | String | 01 | 白天天气代号 |
- daytime | String | 20161106 | 日期 |
- day_weather_pic | String | http://appimg.showapi.com/images/weather/icon/day/01.png | 白天天气图片 |
- night_air_temperature | String | 21 | 夜晚气温 |
- day_air_temperature | String | 27 | 白天气温 |
- day_wind_direction | String | 无持续风向 | 白天风力 |
- night_weather_pic | String | http://appimg.showapi.com/images/weather/icon/night/01.png | 夜晚天气图片 |
- night_wind_direction | String | 北风 | 夜晚风力 |
areaCode | String | 350500 |
4.3.7请求代码示例:
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-12","showapi_appid","showapi_sign")
.addTextPara("areaCode","530700")
.addTextPara("areaid","101291401")
.addTextPara("area","丽江")
.post();
System.out.println(res);
4.3.8返回示例:
{
"showapi_res_code": 0,
"showapi_res_error": "",
"showapi_res_id":"ce135f6739294c63be0c021b76b6fbff",
"showapi_res_body": {
"ret_code": 0,
"area": "南安",
"areaid": "101230506",
"areaCode":"350500",
"day40List": [
{
"night_weather_code": "01",
"day_weather": "多云",
"night_weather": "多云",
"night_wind_power": "微风",
"day_wind_power": "微风",
"day_weather_code": "01",
"daytime": "20161106",
"day_weather_pic": "http://appimg.showapi.com/images/weather/icon/day/01.png",
"night_air_temperature": "21",
"day_air_temperature": "27",
"day_wind_direction": "无持续风向",
"night_weather_pic": "http://appimg.showapi.com/images/weather/icon/night/01.png",
"night_wind_direction": "北风"
},
{
"night_weather_code": "01",
"day_weather": "晴",
"night_weather": "多云",
"night_wind_power": "3-4级",
"day_wind_power": "微风",
"day_weather_code": "00",
"daytime": "20161107",
"day_weather_pic": "http://appimg.showapi.com/images/weather/icon/day/00.png",
"night_air_temperature": "21",
"day_air_temperature": "27",
"day_wind_direction": "无持续风向",
"night_weather_pic": "http://appimg.showapi.com/images/weather/icon/night/00.png",
"night_wind_direction": "北风"
}
]
}
}
五、历史天气查询
5.1 id或名称-->查询历史天气
5.1.1接入点说明:
根据地区id或名称查询历史天气。每次返回一个地区1个月的数据。历史数据从2011年开始。
5.1.2接口地址:
http[s]://route.showapi.com/9-7?showapi_appid=替换自己的值&showapi_sign=替换自己的值
5.1.3返回格式:
json
5.1.4更新频率:
每天早上4:00更新昨天历史天气
5.1.5请求参数:
参数名称 | 类型 | 示例值 | 必须 | 描述 |
---|---|---|---|---|
areaCode | String | 110000 | 否 | 地区code |
areaid | String | 101010100 | 否 | 地区id |
month | String | 201601 | 否 | 查询的月份,格式yyyyMM。最早的数据是2011年1月。 |
startDate | String | 20160504 | 否 | 查询的开始日期,格式yyyyMMdd。最早的数据是2011年1月1日。 |
endDate | String | 20160510 | 否 | 查询的结束日期,格式yyyyMMdd。最早的数据是2011年1月1日。 |
area | String | 北京 | 否 | 地区名称。id和code和名称必须输入其中1个。如果都输入,以code为准 |
5.1.5返回参数:
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
area | String | 北京 | 所查询地区名称 |
areaid | String | 101010100 | 所查询地区的id(以后可能会废弃,已areaCode为准) |
list | Object[] | 所查月分每日的天气历史记录。 | |
- 0 | Object | ||
- max_temperature | String | 2℃ | 最高温度 |
- min_temperature | String | -7℃ | 最低温度 |
- time | String | 20160113 | 时间 |
- weather | String | 晴-多云 | 天气 |
- wind_direction | String | 无持续风向 | 风向 |
- wind_power | String | 微风 | 风力 |
- aqiLevel | String | 空气质量等级 | |
- aqi | String | 空气质量指数(若无指数返回-1) | |
- aqiInfo | String | 空气质量指数类别 | |
month | String | 201601 | 所查询月份 |
ret_code | Number | 0 | 0为成功,其他失败 |
areaCode | String | 110000 | 所查地区code |
startDate | String | 开始日期(输入参数month有值的情况下,以month为准) | |
endDate | String | 结束日期(输入参数month有值的情况下,以month为准) |
5.1.6请求示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-7","showapi_appid","showapi_sign")
.addTextPara("areaCode","110000")
.addTextPara("areaid","101010100")
.addTextPara("month","201601")
.addTextPara("startDate","20160504")
.addTextPara("endDate","20160510")
.addTextPara("area","北京")
.post();
System.out.println(res);
5.1.6返回示例
{
"showapi_res_error": "",
"showapi_res_code": 0,
"showapi_res_id": "5f619fef8d57bae110c4628d",
"showapi_res_body": {
"startDate": "20160504",
"ret_code": 0,
"area": "北京",
"areaCode": "110000",
"month": "201601",
"showapi_fee_code": 0,
"areaid": "101010100",
"endDate": "20160510",
"list": [
{
"aqiLevel": "6",
"time": "20160101",
"min_temperature": "-4℃",
"wind_direction": "无持续风向",
"wind_power": "微风",
"aqi": "311",
"weather": "霾",
"max_temperature": "5℃",
"aqiInfo": "严重污染"
},
{
"aqiLevel": "6",
"time": "20160102",
"min_temperature": "-4℃",
"wind_direction": "无持续风向",
"wind_power": "微风",
"aqi": "415",
"weather": "霾-雾",
"max_temperature": "6℃",
"aqiInfo": "严重污染"
},
{
"aqiLevel": "5",
"time": "20160103",
"min_temperature": "-4℃",
"wind_direction": "无持续风向~北风",
"wind_power": "微风~3-4级",
"aqi": "285",
"weather": "霾-多云",
"max_temperature": "3℃",
"aqiInfo": "重度污染"
},
{
"aqiLevel": "1",
"time": "20160104",
"min_temperature": "-6℃",
"wind_direction": "北风~无持续风向",
"wind_power": "3-4级~微风",
"aqi": "22",
"weather": "多云-晴",
"max_temperature": "2℃",
"aqiInfo": "优"
}
]
}
}
六、工具
6.1 地名-->查询对应的地名id
6.1.1接入点说明:
地名会存在重名的情况,为了避免这一情况的发生,在此提供了地名和区域ID的对应关系,然后根据区域ID来查询24小时天气、未来15天预报、历史天气等数据。
6.1.2接口地址:
http[s]://route.showapi.com/9-3?showapi_appid=替换自己的值&showapi_sign=替换自己的值
6.1.3返回格式:
json
6.1.4请求参数:
6.1.5返回参数:
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
ret_code | Number | 0 | 0为成功,其他失败 |
list | Object[] | 根据地名模糊匹配出来的城市列表。 | |
- 0 | Object | ||
- prov | String | 云南 | 城市所在省 |
- area | String | 丽江 | 地名 |
- cityInfo | Object | 城市信息 | |
- c6 | String | yunnan | 城市所在省英文名 |
- c5 | String | 丽江 | 城市所在市中文名 |
- c4 | String | lijiang | 城市所在市英文名 |
- c3 | String | 丽江 | 城市中文名 |
- c9 | String | 中国 | 城市所在国家中文名 |
- c8 | String | china | 城市所在国家英文名 |
- c7 | String | 云南 | 城市所在省中文名 |
- c17 | String | +8 | 时区 |
- c16 | String | AZ9888 | 雷达站号 |
- c1 | String | 101291401 | 区域id |
- c2 | String | lijiang | 城市英文名 |
- longitude | Number | 100.22 | 经度 |
- c11 | String | 0888 | 城市区号 |
- c10 | String | 2 | 城市级别 |
- latitude | Number | 26.9 | 纬度 |
- c12 | String | 674100 | 邮编 |
- c15 | String | 2394 | 海拔 |
- distric | String | 丽江 | 地区 |
- areaid | String | 101291401 | 地名id |
- areaCode | String | 530700 | 地区code |
6.1.6请求示例
以下是JAVA代码示例:
//更多说明请访问仓库地址:https://github.com/showapi-public/showapi_sdk_java
//这里需要替换为你自己的showapi_appid和showapi_sign,你可以在这里找到 https://www.showapi.com/console#/myApp
String res=new ShowApiRequest("http://route.showapi.com/9-3","showapi_appid","showapi_sign")
.addTextPara("area","丽江")
.post();
System.out.println(res);
6.1.7返回示例
{
"showapi_res_error": "",
"showapi_res_code": 0,
"showapi_res_id": "3caf6167505d4cbc9443934efb884d7b",
"showapi_res_body": {
"ret_code": 0,
"showapi_fee_code": 0,
"list": [
{
"prov": "云南",
"area": "丽江",
"cityInfo": {
"c6": "yunnan",
"c5": "丽江",
"c4": "lijiang",
"c3": "丽江",
"c9": "中国",
"c8": "china",
"c7": "云南",
"c17": "+8",
"c16": "AZ9888",
"c1": "101291401",
"c2": "lijiang",
"longitude": 100.222,
"c11": "0888",
"c10": "2",
"latitude": 26.903,
"c12": "674100",
"c15": "2394",
},
"distric": "丽江",
"areaid": "101291401",
"areaCode":"530700"
}
]
}
}
应用场景
天气预报应用程序:可以供开发人员构建天气预报应用程序,用户可以通过这些应用程序获取当前和未来几天的天气状况。
旅行和旅游平台:旅行和旅游平台可以使用其来提供目的地的天气信息,帮助用户计划旅行并选择适当的时间。
农业和农业管理:农民和农业专业人员可以使用其来获取天气信息,以便更好地管理农作物的种植和灌溉计划。
房地产应用程序:房地产应用程序可以使用其来向用户提供特定地区的天气信息,帮助他们做出购买或租赁房屋的决策。
交通和航空业:交通和航空公司可以使用其来提供航班延误和天气警报等信息,以便旅客能够做出相应的安排。
户外活动规划:户外活动应用程序可以使用其来提供天气信息,帮助用户计划钓鱼、远足、露营等户外活动。
媒体和新闻机构:媒体和新闻机构可以使用其来提供实时天气信息,包括天气预警和灾害警报等,以便向公众传达相关信息。
八、天气对饮应的图标序号
官网查看帮助手册