I am using it to fetch data from Tibber, a Scandinavian power company. Their API can provide historical as well as live data. I can get the former to work with GhostXML, not the latter. It it possible to get live data using GhostXML? (I'm a newbie when it comes to coding, so please excuse me if the question is poorly worded.)
By using a raw curl string I am able to get this to work:
- Code: Select all
curl \
-H "Authorization: Bearer 96a14971-525a-4420-aae9-e5aedaa129ff" \
-H "Content-Type: application/json" \
-X POST \
-d '{ "query": "{ viewer { homes { consumption(resolution: HOURLY, last: 12) { nodes { from to cost unitPrice consumption } } } }}" }'
When I try to replace the query with the following (that works well in Tibbers API explorer), I get a syntax error from GhostXML. (I keep the line breaks for readability:)
- Code: Select all
subscription{
liveMeasurement(homeId:"96a14971-525a-4420-aae9-e5aedaa129ff"){
timestamp
power
accumulatedConsumption
accumulatedCost
currency
minPower
averagePower
maxPower
}
}
So is it possible to get a subscription query like this to work? If that is the case, how should it be input?