Sample code for 30+ languages & platforms
C++

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.

Chilkat C++ Downloads

C++
#include <CkHttp.h>
#include <CkHttpResponse.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.

    CkHttp http;

    // Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
    const char *requestBody = "{ \"abc\": 123 }";
    CkHttpResponse resp;
    success = http.HttpStr("DELETE","https://example.com/something",requestBody,"utf-8","application/json",resp);
    if (success == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    std::cout << "Response status: " << resp.get_StatusCode() << "\r\n";
    std::cout << "Response body: " << "\r\n";
    std::cout << resp.bodyStr() << "\r\n";
    }