News! Upgrade of API Multilingual feature. US cities search by states

News! Upgrade of API Multilingual feature. US cities search by states

Posted on 30 Jan 2020

The  OpenWeather team has made two important updates this month in the Current weather data product. Hope, you’ll enjoy more user-friendly experience.

Upgrade of API Multilingual feature

It’s been a while since our weather APIs started supporting a multilingual weather description in the field ‘description’ (for example, ‘description’: ‘clear sky’). The language of API response can be specified in the ‘lang’ parameter by the language code. The list of language codes is available here. The default language of API response is English when lang parameter is not set.

Now, API response contains the location name in addition to weather description in the language which was specified in the ‘lang’ parameter.

Please note, multilanguage coverage is not supported for some locations. Therefore location nameshould be rendered in the user's selected language if available, or in English by default if not.

Also, an API response should be returned in the same language as the language of requested location name if the location is in our predefined list of more than 200k cities.

API calls using Cities within a rectangle zoneCities in cycle and Call for several city IDs features support only one multilanguage field – field ‘description’.

Example of API call:
http://api.openweathermap.org/data/2.5/forecast/daily?id=524901&[location]&lang={lang}&appid={YOUR API KEY}

where location can be set by:

• {city name}
• {city name}, {country code}
• {city name}, {state}, {country code}

US cities search by states

Previously, the city search was performed in weather APIs by country code and/or city name.
But the fact that some cities may share the same name in the same country could make the search quite confusing.
Following enhancement requests from our US users, the search was updated to recognise cities with the same name in different states. Just make an API call with a state code (in {state} field) in addition to a city name to get the right city back.  

Please note, such behaviour is only applied to USA locations.

Example of API call:

http://history.openweathermap.org/data/2.5/history/city?q={city name},{state},{country code}&type=hour&start={start}&end={end}&appid={YOUR API KEY}

The {state} parameter should follow the city name and preceed the country code.

Stay tuned for further updates and announcements!

We would like to thank you for being our customers. Your feedback is very important as we are constantly looking for ways to improve our products.

Your comments and suggestions are always welcome at info@openweathermap.org