/weatherapi

Weather Rest Api for openweathermap

Primary LanguageJava

weatherapi

Weather Rest Api for OpenWeatherMap

  1. Install the maven dependencies in pom.xml.
  2. Run the application with java 17 SDK.
  3. Open the swagger on :
  4. http://localhost:8024/swagger-ui/index.html#/city-controller

image

There are 3 endpoints.

image

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. image

image

When post mapping is executed, it takes appid for confirmation on OpenWeatherMap and city name. For example:

City name: Istanbul

image

For Prague:

image

image

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.

image

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.

image

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.

image

If the city is not on the list, it will return an exception:

image

image