Win a copy of Rust Web Development this week in the Other Languages 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Consuming an existing API with SpringBoot

 
Ranch Hand
Posts: 86
  • 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: 86
  • 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
 
grapes are vegan food pellets. Eat this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic