This week's giveaway is in the Java in General forum.
We're giving away four copies of Java Challengers and have Rafael del Nero on-line!
See this thread for details.
Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Consuming an existing API with SpringBoot

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic