Sample code for 30+ languages & platforms
Node.js

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    var http = new chilkat.Http();

    // Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
    var requestBody = "{ \"abc\": 123 }";
    var resp = new chilkat.HttpResponse();
    success = http.HttpStr("DELETE","https://example.com/something",requestBody,"utf-8","application/json",resp);
    if (success == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log("Response status: " + resp.StatusCode);
    console.log("Response body: ");
    console.log(resp.BodyStr);

}

chilkatExample();