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

Populate a parameter value from Rest Server (Using Home.js)

fbdsilva
8-Gravel

Populate a parameter value from Rest Server (Using Home.js)

Hi Experts,

 

Would be possible to populate a parameter value from a Rest Server coding a javascript on home.js?

I have a IoT Gateway on Kepware which reads values from controllers and publish those on a Rest Server, then I need to use those values on Vuforia Studio WHITHOUT ThingWorx.

This requirement is because I do not want to have (pay for) ThingWorx to act just as a gateway since I just need real-time values on Vuforia Studio.

I know ThingWorx is there with Vuforia, but in order to use it to collect this data on Things I would need to license it, right?

 

All ideas is welcome.

 

Many Thanks,

Felipe Duarte

1 ACCEPTED SOLUTION

Accepted Solutions
sdidier
17-Peridot
(To:fbdsilva)

Hello FbdSilva,

 

Yes in https, it should work.

I used this Javascript code in my test :

function GetDataREST () 
{
  console.log('GetDataREST');
  
  fetch('https://ghibliapi.herokuapp.com/films')
  .then(response => response.json())
  .then(json => {console.log(json); })
  .catch(error =>{ console.error(error);}) 

}

GetDataREST();

 

Best regards,

Samuel

View solution in original post

4 REPLIES 4
sdidier
17-Peridot
(To:fbdsilva)

Hello fbdsilva,

 

Please read this post from Roland :

https://community.ptc.com/t5/Vuforia-Studio/How-to-read-sensors-via-Rest-API-call-in-and-display-it-Vuforia/m-p/581091

 

Yes, it is possible but only for https.

When using http URL to fetch data, it is not working.

 

Best regards,

Samuel

Hi Samuel,

 

Thanks for replying.

 

Yes, I have read that post before but there it is showing how to make that from ThingWorx. 

Just to be clear, if I used those javascript from the very beginning of the post with https it would work? Because I have tested a lot and could not make it work but I will try again if it is possible.

 

Thanks,

Felipe Duarte

sdidier
17-Peridot
(To:fbdsilva)

Hello FbdSilva,

 

Yes in https, it should work.

I used this Javascript code in my test :

function GetDataREST () 
{
  console.log('GetDataREST');
  
  fetch('https://ghibliapi.herokuapp.com/films')
  .then(response => response.json())
  .then(json => {console.log(json); })
  .catch(error =>{ console.error(error);}) 

}

GetDataREST();

 

Best regards,

Samuel

Many thanks Samuel! 

Top Tags