Sample code for 30+ languages & platforms
Unicode C++

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.

Chilkat Unicode C++ Downloads

Unicode C++
#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());
    }