查詢天氣預報在APP中常用的一個常用功能,聚合數據全國天氣預報api接口可以根據根據城市名/id查詢天氣、根據IP查詢天氣、據GPS坐標查詢天氣、查詢城市天氣三小時預報,並且支持全國不同城市天氣預報查詢。
全國天氣預報API:https://www.juhe.cn/docs/api/id/39
1.首先登錄聚合數據,在API列表中找到全國天氣預報api接口:

2.如需調用該數據,則需要申請密鑰,點擊“申請數據”進行申請,獲取APPKEY:

3.查看演示:

4.JSON返回示例:
{
"resultcode": "200",
"reason": "查詢成功!",
"result": {
"sk": { /*當前實況天氣*/
"temp": "21", /*當前溫度*/
"wind_direction": "西風", /*當前風向*/
"wind_strength": "2級", /*當前風力*/
"humidity": "4%", /*當前濕度*/
"time": "14:25" /*更新時間*/
},
"today": {
"city": "天津",
"date_y": "2014年03月21日",
"week": "星期五",
"temperature": "8℃~20℃", /*今日溫度*/
"weather": "晴轉霾", /*今日天氣*/
"weather_id": { /*天氣唯一標識*/
"fa": "00", /*天氣標識00:晴*/
"fb": "53" /*天氣標識53:霾 如果fa不等於fb,說明是組合天氣*/
},
"wind": "西南風微風",
"dressing_index": "較冷", /*穿衣指數*/
"dressing_advice": "建議着大衣、呢外套加毛衣、衛衣等服裝。", /*穿衣建議*/
"uv_index": "中等", /*紫外線強度*/
"comfort_index": "",/*舒適度指數*/
"wash_index": "較適宜", /*洗車指數*/
"travel_index": "適宜", /*旅游指數*/
"exercise_index": "較適宜", /*晨練指數*/
"drying_index": ""/*干燥指數*/
},
"future": [ /*未來幾天天氣*/
{
"temperature": "28℃~36℃",
"weather": "晴轉多雲",
"weather_id": {
"fa": "00",
"fb": "01"
},
"wind": "南風3-4級",
"week": "星期一",
"date": "20140804"
},
{
"temperature": "28℃~36℃",
"weather": "晴轉多雲",
"weather_id": {
"fa": "00",
"fb": "01"
},
"wind": "東南風3-4級",
"week": "星期二",
"date": "20140805"
},
{
"temperature": "27℃~35℃",
"weather": "晴轉多雲",
"weather_id": {
"fa": "00",
"fb": "01"
},
"wind": "東南風3-4級",
"week": "星期三",
"date": "20140806"
},
{
"temperature": "27℃~34℃",
"weather": "多雲",
"weather_id": {
"fa": "01",
"fb": "01"
},
"wind": "東南風3-4級",
"week": "星期四",
"date": "20140807"
},
{
"temperature": "27℃~33℃",
"weather": "多雲",
"weather_id": {
"fa": "01",
"fb": "01"
},
"wind": "東北風4-5級",
"week": "星期五",
"date": "20140808"
},
{
"temperature": "26℃~33℃",
"weather": "多雲",
"weather_id": {
"fa": "01",
"fb": "01"
},
"wind": "北風4-5級",
"week": "星期六",
"date": "20140809"
},
{
"temperature": "26℃~33℃",
"weather": "多雲",
"weather_id": {
"fa": "01",
"fb": "01"
},
"wind": "北風4-5級",
"week": "星期日",
"date": "20140810"
}
]
},
"error_code": 0
}
