3

Is it possible to get xml data from openweathermap by country?

As I search in documentation I have notice that you can search by this diffrent ways:

  • By city name
  • By geographic coordinate
  • By city ID

For example: This is url for getting data by city name:

http://api.openweathermap.org/data/2.5/forecast/daily?q=Berlin&mode=xml&units=metric

So if you put instead city name (Berlin) in q=? just a country:

http://api.openweathermap.org/data/2.5/forecast/daily?q=Germany&mode=xml&units=metric

I would get an error message: {"message":"","cod":"404"}

Thanks for help

John Slegers
  • 45,213
  • 22
  • 199
  • 169
DaniKR
  • 2,418
  • 10
  • 39
  • 48
  • Doublecheck your response. I get the information. However, what is Germany's weather: ice cold Zugspitze or mild Freiburg? If we have to define Russian's weather, the extremes are even bigger. Openweathermap will show you just the weather info from Alexanderplatz in Berlin. What are you trying to do with the info? – agustin Apr 08 '15 at 13:06
  • @agustin Yes I also get information, but if you would try a few times to get data from url that search by country, you would get an error message 404, I have also search what this 404 mean in openweather map, it means that your request does not find a city that you search. – DaniKR Apr 08 '15 at 13:10
  • here is an example for my country (you would get error): http://api.openweathermap.org/data/2.5/forecast/daily?q=Slovenia&mode=xml&units=metric&cnt=3 – DaniKR Apr 08 '15 at 13:14
  • 1
    Something has to be wrong with your browser or your iconnection, because I get a Succesful 2xx status on my side. Not only I get the XML, but also using JSON mode, or even changing Slovenia for Slovenija it works – agustin Apr 08 '15 at 13:52

0 Answers0