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

Not able to call rest API deployed on cloud

pmishra-4
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.

Tags (1)
3 REPLIES 3

Re: Not able to call rest API deployed on cloud

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

Re: Not able to call rest API deployed on cloud

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;

Re: Not able to call rest API deployed on cloud

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

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.