S
S
Stepan2015-12-16 15:10:00
JavaScript
Stepan, 2015-12-16 15:10:00

Why is POST not being sent to Nodejs?

var data = querystring.stringify({
  "ID": 0,
  "PropertyID": 197688,
  "CheckIn" : "2016-01-25",
  "CheckOut" : "2016-01-30",
  "Renter": {
    "FirstName": "Victor",
    "LastName": "Smith",
    "PrimaryEmail": "[email protected]"
  }
});

var options = {
  host: url,
  path: path,
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Content-Length': Buffer.byteLength(data)
  }
}


var req = http.request(options, function(res) {

    res.setEncoding('utf8');
    res.on('data', function (chunk) {
      console.log('BODY: ' + chunk);
    });
});

req.write(data);
req.end();

Returns BODY: { "error": { "message": "Value cannot be null.\r\nParameter name: value", "code": "0"}}
What could be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2015-12-16
@bingo347

Did you try to read the text of the returned error?
The service expects a value parameter from you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question