I can do this for POST
ResponseEntity<ResponseMessage> response = restTemplate.postForEntity(URL, animal, ResponseMessage.class);
return response.getBody();
But why there is no putForEntity for PUT? There is just resTemplate.put(...
How do I do it for 'PUT' request.
You can use:
restTemplate.exchange(url, HttpMethod.PUT, requestEntity, ...)
Here is the link to the documentation of this method.
You can use PUT instead, reason why putForEntity is not available because as per standard PUT will not return a response body but 201 or 200 in most of the cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With