Article - CS297682

Resources["ContentLoaderFunctions"].GetJSON(params) not returning expected results, in ThingWorx

Modified: 15-Feb-2020   


Applies To

  • ThingWorx Platform 8.3

Description

  • Running this code in ThingWorx:
var headers = {
"Content-Type": 'application/json'
};
var params = {
url: me.URL_GetToken /* STRING */,
useProxy: true /* BOOLEAN */,
proxyPort: Things["Test_Proxy"].Port /* INTEGER */,
proxyScheme: 'http' /* STRING */,
proxyHost:Things["Test_Proxy"].IP_Address /* STRING */,
headers: headers,
password: me.Password /* STRING */,
username: me.UserName /* STRING */
};
// result: JSON
var result = Resources["ContentLoaderFunctions"].GetJSON(params);
me.GetTokenResult = Resources["ContentLoaderFunctions"].GetJSON(params);
logger.debug("Test_Thing: " + result);
  • The result is:
{
"headers": {
"Content-Type": "application/json"
}
}
 
  • Running the call from PostMan, the call provides a valid result
    • Passing the username and password (using basic authentication)
    • Header: "Content-Type" = "application/json"
  • Resources["ContentLoaderFunctions"].GetJSON(params) not returning expected results because of mentioned proxyHost parameter
This is a printer-friendly version of Article 297682 and may be out of date. For the latest version click CS297682