Inspiration
The original concept of the idea was to make an application that would send the user a text message about the weather along with specific information like the weather, wind, what it feels like and so on. However as I didn't know how to make such a concept into reality I started off smaller with simply return the information into the terminal.
What it does
The program prompts the user to enter a valid zip code and then uses the zip code to create a url which is then used by the HttpURL connection class to then make a get request to the REST API to retrieve the weather information of the specified zip code. The response code from the website is also checked to make sure the connection was secured and if so its stored as a stringBuilder object. The information is then deserialized using the JacksonLibraries ObjectMapper class which turns the JSON data into POJO to make it easier to extract the needed information.
How we built it
The project consisted of using the Weather API from "weatherAPI.com" Using JacksonLibrary to read in JSON data HttpsURLConnection in order to establish a connection with the API in java
Challenges we ran into
Due to not having any familiarity working with API I didnt know how to establish a connection with API or how to work with JSON data however using JacksonLibrary was a big help however I wasn't aware that in order to use I had to download the library which took a while to come to that result. Being able to access the JSON data was another issue as the resources I used had examples of JSON data that were in arrays and straight forward yet the JSON data I used consisted of several objects with some nested within each other so accessing them proved to be a challenge. The documentation of the API I used also stated some values had a data type of "decimal" which I had used a float for to hopefully get the result intended however it proved to result in null and after some research I came to the conclusion that i could use bigDecimal as it was common to use in API for accuracy in numbers.
Accomplishments that we're proud of
Being able to have a project that works with an API and learning more about how to implement it into java programming without the use of Android studio which some resources frequently used.
What we learned
I learned how to work with an API as well as how to access JSON data and deserialize it. Also how to work with new libraries.
What's next for Weather terminal App
I hope to improve on the project by adding a front end to it and add features such as if the weather falls between a certain amount a personalized message could be outputted such as "its 40 degrees out make sure to wear a jacket" or fulfill the original concept idea and have notifications be sent straight to ones phone.
Built With
- httpsurlconnection
- jacksonlibrary
- java
- weatherapi
Log in or sign up for Devpost to join the conversation.