Skip to Content
avatar image
Former Member

Unable to call RDMS API through Destination


I am trying to access the devicetypes of IoT using the API which I need to do in one of my projects (there are several other things to be done, but this is the first step).

I am stuck as I am getting the following error while calling the API through destination -

HttpClient.request: request failed: internal error occurred "Failed to send request to socket...rc = -1"

I have one destination file with extension "xshttpdest" whose contents are below -

description = "get all devices";
host = "";
port = 443;
pathPrefix = "/";
proxyType = none;
proxyHost = "";
proxyPort = 0;
authType = none;
useSSL = false;
timeout = 9999;

To access this destination and to get the data from API, I have below xsjs file:

var dest = $.net.http.readDestination("folder", "destinationname");
var client = new $.net.http.Client();
var req = new $.net.http.Request($.net.http.GET,"");
req.contentType = "application/json;charset=utf-8";
client.request(req, dest);
var response = client.getResponse();
$.response.contentType = "application/json";

Had been trying to figure out what the error is from quite sometime now but cannot figure out what the problem is.If anyone has done this before, pls help me out.

Thanks a lot in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 26, 2017 at 08:03 PM


    You'll have to set the proxy settings in the xshttpdest file as described here:

    Best regards


    Add comment
    10|10000 characters needed characters exceeded

  • Apr 27, 2017 at 05:14 AM

    Please, see similar setup discussed in here (there is also one link to archive in comments).

    P.S. Please, use search functionality of the Community before posting.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 08, 2017 at 04:35 PM

    If you are using the HCP trial instance by any chance, then you need to use the proxy for sure. I had a similar issue with the simple job scheduling example with the yahoo stock ticker and did not realize the proxy needs to be in place for using HTTP destinations through HCP.

    useProxy = true;
    proxyHost = “proxy-trial”;
    proxyPort = 8080;

    Add comment
    10|10000 characters needed characters exceeded