title: How to send DELETE with JSON to the REST API using HttpClient
body: <p>I have to send a delete command to a REST API service with JSON content using the HttpClient class and can't make this working.</p>
  
  <p>API call:</p>
  
  <pre><code>DELETE /xxx/current
  {
   "authentication_token": ""
  }
  </code></pre>
  
  <p>because I can't add any content into below statement:</p>
  
  <pre><code>HttpResponseMessage response = client.DeleteAsync(requestUri).Result;
  </code></pre>
  
  <p>I know how to make this work with RestSharp:</p>
  
  <pre><code>var request = new RestRequest {
      Resource = "/xxx/current",
      Method = Method.DELETE,
      RequestFormat = DataFormat.Json
  };
  
  var jsonPayload = JsonConvert.SerializeObject(cancelDto, Formatting.Indented);
  
  request.Parameters.Clear();
  request.AddHeader("Content-type", "application/json");
  request.AddHeader ("Accept", "application/json");
  request.AddParameter ("application/json", jsonPayload, ParameterType.RequestBody);
  
  var response = await client.ExecuteTaskAsync (request);
  </code></pre>
  
  <p>but I have get it done without RestSharp.</p>