(Unicode 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.
#include <CkHttpW.h>
#include <CkHttpResponseW.h>
void ChilkatSample(void)
{
bool success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
// Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
const wchar_t *requestBody = L"{ \"abc\": 123 }";
CkHttpResponseW resp;
success = http.HttpStr(L"DELETE",L"https://example.com/something",requestBody,L"utf-8",L"application/json",resp);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
wprintf(L"Response status: %d\n",resp.get_StatusCode());
wprintf(L"Response body: \n");
wprintf(L"%s\n",resp.bodyStr());
}
|