Weather Rest Api for OpenWeatherMap
- Install the maven dependencies in pom.xml.
- Run the application with java 17 SDK.
- Open the swagger on :
- http://localhost:8024/swagger-ui/index.html#/city-controller
There are 3 endpoints.
When post mapping is executed, it takes appid for confirmation on OpenWeatherMap and city name. If there is no city with the given name, the following exception will be executed.
When post mapping is executed, it takes appid for confirmation on OpenWeatherMap and city name. For example:
City name: Istanbul
For Prague:
The API endpoint will return the highest and lowest degrees and also cityID.
If the same city is requested again, it will return an exception.
Cities are stored in a HashMap inside of the CityStoreService. When the application finish, the storage will be destroyed.
The second GET endpoint will return all cities.
The third endpoint will take a cityID from one of the cities which is already been added to the list and return the information of that city.
If the city is not on the list, it will return an exception: