使用Postman获取天气接口API(Json格式)

一、接口URL

http://wthrcdn.etouch.cn/weather_mini

二、请求参数

参数名称 类型 是否必须 说明
province string 1 对应哪个省
city string 1 对应哪个城市

三、使用Postman发起Get请求

在这里插入图片描述
以下为请求得到的数据:
{“data”:{“yesterday”:{“date”:“28日星期一”,“high”:“高温 28℃”,“fx”:“无持续风向”,“low”:“低温 21℃”,“fl”:"<![CDATA[<3级]]>",“type”:“多云”},“city”:“深圳”,“forecast”:[{“date”:“29日星期二”,“high”:“高温 27℃”,“fengli”:"<![CDATA[<3级]]>",“low”:“低温 20℃”,“fengxiang”:“无持续风向”,“type”:“晴”},{“date”:“30日星期三”,“high”:“高温 27℃”,“fengli”:"<![CDATA[3-4级]]>",“low”:“低温 20℃”,“fengxiang”:“东北风”,“type”:“多云”},{“date”:“31日星期四”,“high”:“高温 27℃”,“fengli”:"<![CDATA[3-4级]]>",“low”:“低温 21℃”,“fengxiang”:“东北风”,“type”:“晴”},{“date”:“1日星期五”,“high”:“高温 28℃”,“fengli”:"<![CDATA[3-4级]]>",“low”:“低温 22℃”,“fengxiang”:“东北风”,“type”:“晴”},{“date”:“2日星期六”,“high”:“高温 28℃”,“fengli”:"<![CDATA[<3级]]>",“low”:“低温 22℃”,“fengxiang”:“无持续风向”,“type”:“晴”}],“ganmao”:“各项气象条件适宜,无明显降温过程,发生感冒机率较低。”,“wendu”:“23”},“status”:1000,“desc”:“OK”}

所以,在后续写程序的过程中,我们应当以Json的格式来解析这部分数据,得到我们想要的接口

发布了597 篇原创文章 · 获赞 1061 · 访问量 182万+

猜你喜欢

转载自blog.csdn.net/morixinguan/article/details/102804250
今日推荐