I want to get the object as well as the HTTP response
of one api
into another in Spring
code. For that I am using a rest template
and I am getting the desired Object
from it successfully.
But I want to fetch HTTP response
also for the respective api
.
What should I do to get this?
RestTemplate restTemplate = new RestTemplate();
Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
System.out.println("quote "+quote);
System.out.println(quote.getType());
log.info(quote.toString());