(C#) HTTP DELETE with Body
Demonstrates how to send a DELETE request with a body. Note: This example requires Chilkat v11.0.0 or greater.
bool success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.Http http = new Chilkat.Http();
// Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
string requestBody = "{ \"abc\": 123 }";
Chilkat.HttpResponse resp = new Chilkat.HttpResponse();
success = http.HttpStr("DELETE","https://example.com/something",requestBody,"utf-8","application/json",resp);
if (success == false) {
Debug.WriteLine(http.LastErrorText);
return;
}
Debug.WriteLine("Response status: " + Convert.ToString(resp.StatusCode));
Debug.WriteLine("Response body: ");
Debug.WriteLine(resp.BodyStr);
|