Skip to main content
1-Visitor
May 24, 2020
Question

Connecting external API into Thingworx

  • May 24, 2020
  • 2 replies
  • 3521 views

Hello,
I am trying to connect external API into Thingworx.  But i am unable to receive responses.  I attached my code here.  and i upload my result also.  Please help me to do that.
Code:


var params = {
proxyScheme: undefined /* STRING */,
headers: { 'grant_type':'*****','client_id':'******','client_secret':'******','resource':'*******'},
ignoreSSLErrors: true,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
withCookies: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: "https://******", /* STRING */
timeout: 6000,
proxyPort: undefined /* INTEGER */,
password: undefined /* STRING */,
domain: undefined /* STRING */,
username: undefined /* STRING */
};

// result: JSON
var result = Resources["ContentLoaderFunctions"].GetJSON(params);

 

2 replies

1-Visitor
May 25, 2020

Did you test the API call before with a more "raw" tool like Postman or Curl?

DMu31-VisitorAuthor
1-Visitor
May 25, 2020

Hello,

It's working perfectly in postman... But I am unable to get response from thingworx...  Please help me to do that... 

1-Visitor
May 27, 2020

Headers it's not body it's HTTP Call Headers.

 

If you need to add body, you should use other HTTP Methods (Post or Put) they have the content parameter.

1-Visitor
June 2, 2020

Hi,

can you get the output for the above issue.I am also working on similar to your code.I am also getting the same issue

Thanks,

karthik