标签:
天气查询车联网API http://developer.baidu.com/map/index.php?title=car/api/weather
http://api.map.baidu.com/telematics/v3/weather?location=%E8%8B%8F%E5%B7%9E&output=json&ak=640f3985a6437dad8135dae98d775a09
{
"error": 0,
"status": "success",
"date": "2015-01-19",
"results": [
{
"currentCity": "苏州",
"pm25": "167",
"index": [],
"weather_data": [
{
"date": "周一 01月19日 (实时:8℃)",
"dayPictureUrl": "http://api.map.baidu.com/images/weather/day/qing.png",
"nightPictureUrl": "http://api.map.baidu.com/images/weather/night/duoyun.png",
"weather": "晴转多云",
"wind": "北风3-4级",
"temperature": "10 ~ 3℃"
},
{
"date": "周二",
"dayPictureUrl": "http://api.map.baidu.com/images/weather/day/yin.png",
"nightPictureUrl": "http://api.map.baidu.com/images/weather/night/yin.png",
"weather": "阴",
"wind": "东南风3-4级",
"temperature": "10 ~ 5℃"
},
{
"date": "周三",
"dayPictureUrl": "http://api.map.baidu.com/images/weather/day/yin.png",
"nightPictureUrl": "http://api.map.baidu.com/images/weather/night/duoyun.png",
"weather": "阴转多云",
"wind": "西风4-5级",
"temperature": "11 ~ 1℃"
},
{
"date": "周四",
"dayPictureUrl": "http://api.map.baidu.com/images/weather/day/qing.png",
"nightPictureUrl": "http://api.map.baidu.com/images/weather/night/duoyun.png",
"weather": "晴转多云",
"wind": "西北风4-5级",
"temperature": "8 ~ 1℃"
}
]
}
]
}
http://api.map.baidu.com/telematics/v3/weather?location=%E8%8B%8F%E5%B7%9E&output=xml&ak=640f3985a6437dad8135dae98d775a09
<CityWeatherResponse> <error>0</error> <status>success</status> <date>2015-01-19</date> <results> <currentCity>苏州</currentCity> <weather_data> <date>周一 01月19日 (实时:8℃)</date> <dayPictureUrl> http://api.map.baidu.com/images/weather/day/qing.png </dayPictureUrl> <nightPictureUrl> http://api.map.baidu.com/images/weather/night/duoyun.png </nightPictureUrl> <weather>晴转多云</weather> <wind>北风3-4级</wind> <temperature>10 ~ 3℃</temperature> <date>周二</date> <dayPictureUrl> http://api.map.baidu.com/images/weather/day/yin.png </dayPictureUrl> <nightPictureUrl> http://api.map.baidu.com/images/weather/night/yin.png </nightPictureUrl> <weather>阴</weather> <wind>东南风3-4级</wind> <temperature>10 ~ 5℃</temperature> <date>周三</date> <dayPictureUrl> http://api.map.baidu.com/images/weather/day/yin.png </dayPictureUrl> <nightPictureUrl> http://api.map.baidu.com/images/weather/night/duoyun.png </nightPictureUrl> <weather>阴转多云</weather> <wind>西风4-5级</wind> <temperature>11 ~ 1℃</temperature> <date>周四</date> <dayPictureUrl> http://api.map.baidu.com/images/weather/day/qing.png </dayPictureUrl> <nightPictureUrl> http://api.map.baidu.com/images/weather/night/duoyun.png </nightPictureUrl> <weather>晴转多云</weather> <wind>西北风4-5级</wind> <temperature>8 ~ 1℃</temperature> </weather_data> <index></index> <pm25>167</pm25> </results> </CityWeatherResponse>
学员资料:
http://wthrcdn.etouch.cn/weather_mini?city=深圳
通过城市名字获得天气数据,json数据
http://wthrcdn.etouch.cn/weather_mini?citykey=101280601
通过城市id获得天气数据,json数据
http://wthrcdn.etouch.cn/WeatherApi?citykey=101280601
通过城市id获得天气数据,xml文件数据,
当错误时会有<error>节点
http://wthrcdn.etouch.cn/WeatherApi?city=深圳
通过城市名字获得天气数据,xml文件数据
标签:
原文地址:http://www.cnblogs.com/xubuhang/p/4233150.html