Skip to Content

HTTP PUSH API IOT services issue in xsjs

Jan 20, 2017 at 10:23 AM


avatar image
Former Member

Hello Techies,

I have been trying to call the HTTP PUSH IoT API to push data to a device.

I tried to send the payload using POSTMAN with Basic Authorization and it works perfectly but when I try to push through a xsjs program, it fails.

Below is the xsjs program code:

var req = new $.web.WebRequest($.net.http.POST, "/58f068e5-eacf-4847-93e2-2c24c555aa74");

var data = JSON.stringify({"method":"http","messageType":"fc93815e9342xxxxxx0","messages":[{"CONTROL":0}]});



client.request(req, dest);

var response = client.getResponse().body.asString();

The XSHTTPDEST file content is as below:

host = "";

port = 8080;

pathPrefix = "/";

proxyType = http;

proxyHost = "proxy";

proxyPort = 8080;

authType = basic;

useSSL = false;

timeout = 30000;

The response is:

While trying to retrieve the URL: The content could not be delivered due to the following condition: Connection refused Your cache administrator is:

Is this due to the PORT number that i have used 8000? i have tried changing the port number in the xshttpdest file to 8080 but the error is the same.

Any solution for this would be highly appreciated.

Thanks in Advance.


postman.jpg (97.3 kB)
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Srivatsan,

Were you able to successfully push the data ? I am trying to create a device from rdms api using xsjs code.. I am getting status code 200 but the device is not created in cockpit.


* Please Login or Register to Answer, Follow or Comment.

1 Answer

Anton Levin
Jan 20, 2017 at 10:40 AM

Hello Srivatsan, "iotmms" is running and accessible under HTTPS with the default secure port 443. You have your xs http destination configured to access it via HTTP and port 8080. This will not work. Please, find a similar discussion in archive [1]. There is also an example for the destination. Regards, Anton


10 |10000 characters needed characters left characters exceeded