This week's book giveaway is in the Android forum.
We're giving away four copies of Android Programming: The Big Nerd Ranch Guide and have Bill Phillips & Chris Stewart on-line!
See this thread for details.
Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Consuming an existing API with SpringBoot  RSS feed

 
Geane Norm
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am fairly new to SpringBoot and I am trying to figure out what I need to proceed for my task. In a nutshell, I would like to create to build a service at http://localhost:8080/ that would consume an existing GET API. I have found the following resources, but I feel that what I need for my task is a combination of both:


https://spring.io/guides/gs/consuming-rest/

https://spring.io/guides/gs/rest-service/

My understanding is the what I need is the following, but I would appreciate some direction in terms of what are the main building blocks for the task:

- Model class - something similar to the Greetings.class at https://spring.io/guides/gs/rest-service/
- Application Class. This is where I am confused as it seems that i need to call the existing as API endpoint there using  per here: https://spring.io/guides/gs/consuming-rest/. In my case, this will have:



- Controller Class. This is where the confusion is really at its highest level. So my Application Class is basically getting the API/data source I want, but still I need to implement all the endpoints (for example let's say that we have something like http://whatevermyAPIendpointis/countries returning all countries, for example. What i am trying to do is to have a restful service on my localhost that would map that existing endpoint to localhost/countries. Is this what I should be having in my Controller? Is the understanding of the main building block of my supposed application correct?

Can you help? Any existing resource/tutorial based on a similar task would be incredibly beneficial.

Thank you,

Regards,

Ilaria
 
Geane Norm
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also wanted to add that with the data returned from the existing API i would like to construct a view (jsp) and possibly a drop-down menu. I am OK with setting some mock data in my Controller, so that basically my application acts as a restful service, but i am not sure when it comes to consuming existing api/data source. Thank you so much
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!