Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpMethod.Delete not working with RestTemplate of Spring-Android

I am trying to use DELETE method of HttpMethod. The code that I am using for that is

response = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, Response.class);

I am also using JacksonJson for mapping json. The delete functionality returns the json which should be mapped to Response class. But calling the above line doesn't works and gives internal server error with 500 as response code. But, the same API does work with RESTClient in the browser so I guess there is something that I am not doing correctly.

like image 223
thefrugaldev Avatar asked Aug 30 '13 11:08

thefrugaldev


1 Answers

After doing some more research it seems that DELETE method doesn't supports request body. As we had the control over REST API we have changed the request body to be added as parameters. After doing this change the request is working properly.

Hope it helps someone.

like image 142
thefrugaldev Avatar answered Nov 10 '22 11:11

thefrugaldev