I am working on Rest API using Spring boot and I had to access an application\'s endpoint. I used RestTemplate
for it. I was able to do it using 2 methods,
Execute(..) The most raw form of method, to make REST call.
Exchange(..) A wrapper over Execute method.
PostForEntity(..) A wrapper method, which further eases the use for making REST calls. You specify the request type in the method name itself(getForEntity, postForEntity), so, need not mention request type in the parameter. The method name in itself becomes self explanatory.
In Exchange & postForEntity, response has to be in Json formats. This Json is further converted to Model class by json-mapper libraries. While, in Execute, we accept response in any format, as we pass the deserializer in Response Executor argument.