Get data via Apiary API
Posted: 06 Feb 2015 13:34
I try to get some data from [module] OpenWeather. Ultimately I do want to use that data in a rule. For the moment I just want to get it to OpenRemote. I guess the Apiary API is the way to go. However I do get a problem understanding the documentation. I would expect to get the temperature with:
OpenWeather_72 is the internal id of the OpenWeather widget. But is says: not found
With an online JSONPath tester using
Update 13:51 On OpenRemote I can get the correct value using:
Can't I reach this deep with Apiary API?
Code: Select all
http://raspberry:8083/ZAutomation/api/v1/devices/OpenWeather_72/data/metrics/level
A call with only rhe widget id yields the following JSON blurp:{"data":null,"code":404,"message":"404 Not Found","error":"Device OpenWeather_72/data/metrics/level doesn't exist"}
Code: Select all
{
"data" : {
"creatorId" : 72,
"deviceType" : "sensorMultilevel",
"id" : "OpenWeather_72",
"location" : null,
"metrics" : {
"scaleTitle" : "°C",
"title" : "Leens",
"probeTitle" : "Temperature",
"level" : 0.7,
"icon" : "http://openweathermap.org/img/w/01d.png"
},
"permanently_hidden" : false,
"tags" : [],
"updateTime" : 1423210517
},
"code" : 200,
"message" : "200 OK",
"error" : null
}
Whatever separators I use in the full http string; no success. What am I doing wrong?data.metrics.level
results in:
'0' => "0.7"
Update 13:51 On OpenRemote I can get the correct value using:
Code: Select all
URL: http://raspberry:8083/ZAutomation/api/v1/devices/OpenWeather_72
Method: GET
Content-type: application/json
Polling: 5m
JSONPath: $.data.metrics.level