简体   繁体   中英

openweathermap api to get TODAY and rest of the WEEK DAYS?

I'm wondering if I can call in one request using openweathermap api to get data about (today & all weekdays) at once! I tried this >>

http://api.openweathermap.org/data/2.5/weather?q=london&units=metric&APPID=value

and it gives data for only today

then I tried forecast

http://api.openweathermap.org/data/2.5/forecast/?q=london%2&cnt=7&units=metric&APPID=value

and also this gives me data about some weekdays.

is there any way to get all (today & weekdays ) in one request ?

The api docs at http://openweathermap.org show that there's a "forecast16" api, documented at http://openweathermap.org/forecast16 .

The docs say that you can call

api.openweathermap.org/data/2.5/forecast/daily?q={city name},{country code}&cnt={cnt}

and that {cnt} is number of day's worth of data that you are requesting (from 1 to 16)

So, in your case,

http://api.openweathermap.org/data/2.5/forecast/daily?q=london&units=metric&APPID=value&cnt=7

should give you 7 day's data.

16 day forecasts is available at any location or city. Forecasts include daily weather and available in JSON or XML format. It is only available for all paid accounts.

https://openweathermap.org/forecast16

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM