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

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

SOLVED
Highlighted
Regular Member

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
Highlighted

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

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
Highlighted

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

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

 

Yes, it is possible but only for https.

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

 

Best regards,

Samuel

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

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

Highlighted

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

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

Highlighted

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

Many thanks Samuel! 

Announcements
Join an
AR Working Group!

Topics available:
AR/VR for Data Optimization AR/VR for Security and Control AR/VR for Inspection