天气预报API
聚合API
https://www.juhe.cn/docs
注册个人账号,实名认证后每天有100次免费请求额度。免费API中包括天气预报、新闻头条、笑话大全、万年历等。
![c090a6b7513ffcd0fa8ee49c2e6a1099.png](https://img-blog.csdnimg.cn/img_convert/c090a6b7513ffcd0fa8ee49c2e6a1099.png)
天气预报API
https://www.juhe.cn/docs/api/id/73
接口地址:http://apis.juhe.cn/simpleWeather/query
返回格式:json
请求方式:http get/post
请求示例:http://apis.juhe.cn/simpleWeather/query?city=%E8%8B%8F%E5%B7%9E&key=
接口备注:通过城市名称或城市ID查询天气预报情况
请求参数说明:
| | 名称 | 必填 | 类型 | 说明 | | ---- | ---- | ---- | ------ | ------------------------------------------------------------ | | | city | 是 | string | 要查询的城市名称/id,城市名称如:温州、上海、北京,需要utf8 urlencode | | | key | 是 | string | 在个人中心->我的数据,接口名称上方查看 |
返回参数说明:
| | 名称 | 类型 | 说明 | | ---- | ----------- | ------ | ------------------------- | | | error_code | int | 返回码,0为查询成功 | | | reason | string | 返回说明 | | | result | string | 返回结果集 | | | - | - | - | | | realtime | - | 当前天气详情情况 | | | info | string | 天气情况,如:晴、多云 | | | wid | string | 天气标识id,可参考小接口2 | | | temperature | string | 温度,可能为空 | | | humidity | string | 湿度,可能为空 | | | direct | string | 风向,可能为空 | | | power | string | 风力,可能为空 | | | aqi | string | 空气质量指数,可能为空 | | | - | - | - | | | future | - | 近5天天气情况 | | | date | string | 日期 | | | temperature | string | 温度,最低温/最高温 | | | weather | string | 天气情况 | | | direct | string | 风向 |
JSON返回示例: