function(method, where, what, query, callback) {
    var opts = {};
    if(what == undefined) opts.body = "";
    else opts.body = JSON.stringify(what);
    opts.headers = {};
    opts.headers['Content-Length'] = opts.body.length;
    opts.headers['Content-Type'] = "application/json";
    opts.headers['Authorization'] = "SSWS " + apiKey;
    opts.method = method;
    opts.uri = url.parse(where);
    if(query != null) opts.qs = query;
    request(opts, function(error, clientResp, resp) { handleResponse(error, false, clientResp, resp, callback) });
}
function(method, where, what, query, callback) {
    var opts = {};
    if(what == undefined) opts.body = "";
    else opts.body = JSON.stringify(what);
    opts.headers = {};
    opts.headers['Content-Length'] = opts.body.length;
    opts.headers['Content-Type'] = "application/json";
    opts.headers['Authorization'] = "SSWS " + apiKey;
    opts.method = method;
    opts.uri = url.parse(where);
    if(query != null) opts.qs = query;
    request(opts, function(error, clientResp, resp) { handleResponse(error, false, clientResp, resp, callback) });
}
function ( method , where , what , query , callback ) { var opts = { } ; if ( what == undefined ) opts . body = "" ; else opts . body = JSON . stringify ( what ) ; opts . headers = { } ; opts . headers [ 'Content-Length' ] = opts . body . length ; opts . headers [ 'Content-Type' ] = "application/json" ; opts . headers [ 'Authorization' ] = "SSWS " + apiKey ; opts . method = method ; opts . uri = url . parse ( where ) ; if ( query != null ) opts . qs = query ; request ( opts , function ( error , clientResp , resp ) { handleResponse ( error , false , clientResp , resp , callback ) } ) ; }
POST and PUT requests are mostly identical.
POST and PUT requests are mostly identical .