Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello,
I am trying to retrieve data from a REST API of a 3DPrinter and convert it into real time information through Vuforia View.
I'm stuck when i need to get the data into a Thing Property.
I've created a genericThing and i use getJSON snippets to retrieve JSON from the printer API.
I have no problem getting the JSON from the API using getJSON and those parameters :
let params = {
url: "http://172.25.2.8:10800/v1/printer/nozzle1?token=6721b6ca0a4ea42f3a933e356546588e" /* STRING */,
};
// result: JSON
let result = Resources["ContentLoaderFunctions"].GetJSON(params);
I get this JSON :
{
"headers": "",
"data": {
"nozzle_cur_temp": 26,
"nozzle_tar_temp": 0,
"flow_cur_rate": 100,
"flow_tar_rate": 100
},
"status": 1
}
What i want is to define "nozzle_cur_temp" value (26) as a Thing Property that updates each time i execute the script.
Like this i can use it in Vuforia.
Thanks,
Best Regards,
Solved! Go to Solution.
I've found the solution,
I've created properties in the thing property value.
After this line :
let result = Resources["ContentLoaderFunctions"].GetJSON(params);
I write this :
me.TempBuseGauche = result["data"]["nozzle_cur_temp"];
me.TarTempBuseGauche = result["data"]["nozzle_tar_temp"];
Hope this helps,
I've found the solution,
I've created properties in the thing property value.
After this line :
let result = Resources["ContentLoaderFunctions"].GetJSON(params);
I write this :
me.TempBuseGauche = result["data"]["nozzle_cur_temp"];
me.TarTempBuseGauche = result["data"]["nozzle_tar_temp"];
Hope this helps,