Rest Client
No enterprise applications work in isolation. They have to connect to one or more services to get the required data. Learn to consume a RESTweb service using a SpringREST template and know different methods in the REST template class.
We'll cover the following...
Limitation of spring boot billionaire club
Our spring boot billionaire club application designed in the first section of this course was a perfect start however it has one limitation.
- It feeds the database during start-up from an SQL script file available in the classpath as a result data stored in our database is static in nature.
How can we fix that?
If there is some open API of the billionaire database that we can connect to fetch data during start-up and fill our DB.
We have one such API, Forbes400
.
Forbes400 billionaire API
Forbes 400 is s JSON API of the “Forbes 400 Richest People” list. The full document is available Here: https://forbes400.onrender.com/
Try it out.
Enter “https://forbes400.onrender.com/api/forbes400?limit=10” in our browser and we can see the top 10 richest people in JSON format.
Enhancement to billionaire club
We can consume the forbes400 API to fetch data during the startup of our application, and add all those into our database.
Restful client in Java
Before designing the solution ...