Hello,
I changed my strategie and changed over to node.js “node-rest-client”. I think that one would do.
I changed the example code, and I get an error reesponse (but at least I get a response
)
Here comes the code. I think I have problems with the data block. What do I have to change?
//Example POST method invocation
var Client = require('node-rest-client').Client;
var client = new Client();
// set content-type header and data as json in args parameter
var args = {
data: "123",
headers: { "Content-Type": "application/json" }
};
client.put("http://hab:8080/rest/items/HzgAussenTempMB/state", args, function (data, response) {
// parsed response body as js object
console.log(data);
// raw response
console.log(response);
});
The answer to that call is:
{ error:
{ message: 'HTTP 415 Unsupported Media Type',
'http-code': 415,
exception:
{ class: 'javax.ws.rs.NotSupportedException',
message: 'HTTP 415 Unsupported Media Type',
'localized-message': 'HTTP 415 Unsupported Media Type' } } }
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
...........