Question
Call external Rest API from thingworx application
Hi,
I need to call a REST API from my thingworx application. To achieve that, i try to use the ContentLoaderFunctions resources.
1- Is it the right way ?
2- If yes, i try to call a test Rest API, but it doens't work:
var result = Resources["ContentLoaderFunctions"].GetJSON({
url: "https://jsonplaceholder.typicode.com/todos/1" /* STRING */,
timeout: 30000 /* NUMBER */,
headers:undefined,
ignoreSSLErrors: false /* BOOLEAN */,
useProxy: false /* BOOLEAN */,
proxyHost: undefined /* STRING */,
proxyPort: undefined /* INTEGER */,
proxyScheme: undefined /* STRING */
});
or
var result = Resources["ContentLoaderFunctions"].GetJSON({
url: "https://jsonplaceholder.typicode.com/todos/1" /* STRING */,
timeout: 30000 /* NUMBER */,
headers: {'Host': 'jsonplaceholder.typicode.com', 'Accept':'application/json', 'Content-Type':'application/json'},
ignoreSSLErrors: false /* BOOLEAN */,
useProxy: false /* BOOLEAN */,
proxyHost: undefined /* STRING */,
proxyPort: undefined /* INTEGER */,
proxyScheme: undefined /* STRING */
});
In both cas, i receive
" Error executing service testRTestApiCall. Message :: Received fatal alert: handshake_failure"
Any idea ?
Thanks for your help.

