I tried several search for examples on the web on how to send a DELETE request with TidHTTP without success...
I'm working with Delphi Indy 10.0.52. Apparently there is not such a method as Delete in the TIdHTTP object. Is it possible? I'm missing something here... Help!
I ended up with something (not working) like this:
procedure TRestObject.doDelete( deleteURL:String );
var
res : TStringStream;
begin
res := TStringStream.Create('');
http := TidHTTP creation and init...
try
http.Request.Method := IdHTTP.hmDelete;
http.Put( deleteURL, res );
except
on E: EIdException do
showmessage('Exception (class '+ E.ClassName +'): ' + E.Message);
on E: EIdHTTPProtocolException do
showmessage('Protocol Exception (HTTP status '+ IntToStr(E.ErrorCode) +'): ' + E.Message);
on E: EIdSocketError do
showmessage('Socket Error ('+ IntToStr(E.LastError) +'): ' + E.Message);
end;
res.Free;
end;
This is a method in an object already handling GET, PUT, POST to a RESTful web service implemented with django-tastypie. I have all permissions and authentications set in the object's init phase.