Sample code for 30+ languages & platforms
Node.js

Transition from Http.PostJson3 to Http.HttpJson

Provides instructions for replacing deprecated PostJson3 method calls with HttpJson.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var http = new chilkat.Http();

    var url = "https://example.com/something";
    var contentType = "application/json";
    var json = new chilkat.JsonObject();
    json.LoadFile("C:/temp/requestBody.json");

    //  ------------------------------------------------------------------------
    //  The PostJson3 method is deprecated:

    // responseObj: HttpResponse
    var responseObj = http.PostJson3(url,contentType,json);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using HttpJson.
    //  Your application creates a new, empty HttpResponse object which is passed 
    //  in the last argument and filled upon success.

    var responseOut = new chilkat.HttpResponse();
    success = http.HttpJson("POST",url,json,contentType,responseOut);
    if (success == false) {
        console.log(http.LastErrorText);
        return;
    }


}

chilkatExample();