i have external api uses delete body(json). make use of postman rest client , delete done request body , works fine. trying automate functionality using method.
i tried httpurlconnection similar get, post , put. not sure how use delete request body.
i have checked in stackoverflow , see cannot done, old answers.
can please help? i'm using spring framework.
if using spring, can use resttemplate
generate client request. in case use resttemplate.exchange , provide url, http method , request body. (not tested, idea):
resttemplate resttemplate = new resttemplate(); httpentity<foo> request = new httpentity<>(new foo("bar")); resttemplate.exchange(url, httpmethod.delete, request, null);
Comments
Post a Comment