cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Not able to call rest API deployed on cloud

pmishra-4
1-Newbie

Not able to call rest API deployed on cloud

Hi, i am not able to call rest API deplyoed on cloud, while it's working when rest API is runningon local machine.

3 REPLIES 3

Hello Prabhat,

Can you describe more the problem? I assume that you have a service, in which you are making REST call to external system. This solution is working when you have your external system on your localhost, but not when it is deployed on the cloud?

Can you show us the service also?

Regards,

Adam

Yes, you got it right. here is the code, i am trying. It's working file for commented URL:-

var params1 = {

proxyScheme: undefined /* STRING */,

headers:{

  "Accept": "*/*",

  "tenantId": "12345"

},

ignoreSSLErrors: undefined /* BOOLEAN */,

useNTLM: undefined /* BOOLEAN */,

workstation: undefined /* STRING */,

useProxy: undefined /* BOOLEAN */,

withCookies: undefined /* BOOLEAN */,

    url:"http://dev1.tcupiot.com/app/user5/TTSLService/Alert/Query?eventDateTime=2016-06-12%2C2018-10-15" /* STRING */,

    //url:"http://localhost:8081/TTSLFleetWeb/Alert/Query?eventDateTime=2016-06-12%2C2018-10-15",

    timeout: undefined /* NUMBER */,

proxyPort: undefined /* INTEGER */,

password: undefined /* STRING */, 

username: undefined /* STRING */

};

// result: JSON

var data = Resources["ContentLoaderFunctions"].GetJSON(params1);

var params2 = {

infoTableName: "alertTable" /* STRING */,

dataShapeName: "AlertDataShape" /* DATASHAPENAME */

};

var jsonTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params2);

for(var i=0;i<data.array.length;i++)

{

jsonTable.AddRow({vehicleRegNo:data.array.vehicleRegNo,

                  eventTypeName:data.array.eventTypeName,

                  eventLocDescription:data.array.eventLocDescription,

                 eventDatetime:data.array.eventDatetime,

                  speed:data.array.speed,

                  description:data.array.description

                 });

}

result = jsonTable;

Hello,

The only thing which is coming to my mind is to add your cloud host to the hosts on your machine with ThingWorx Platform.

Here is a guide how to complete this: https://support.rackspace.com/how-to/modify-your-hosts-file/

Let me know if it helps somehow.

Regards,

Adam

Top Tags