Search code examples
asp.netapirestsharp

Delete function IRestResponse with RestSharp


I want to implement a delete function with a Restful API with RestSharp. I have implemended GET and POST function already. But with this delete function I don't get any feedback from the API only a httpresponse. My question is how do I make my code so I can excecute the delete function? I already have this:

//    var url = string.Format("url");

//    Construct the request.
//    var request = new RestRequest(url, Method.DELETE);

//    //IRestResponse<> response;
//    //response = await restClient.ExecuteTaskAsync<>(request);
//    //return response.Data;

Solution

  • try it

    var client = new RestClient(url);
    var request = new RestRequest(Method.DELETE);
    IRestResponse response = client.Execute(request);