Posting a HTTP POST request to a GraphQL server


#1

1) Give a description of the problem
Trying to extract real-time data from a data stream published using GraphQL.
Using HTTP POST to get the current power reading of my Tibber Pulse.

2) What is the expected behaviour?
Running HTTP Post with JSON formated like this:

{“query”:"{subscription{liveMeasurement(homeId:“c70dcbe5-4485-4821-933d-a8a86452737b”){power}}}}

should give me the power reading in the $response variable.
Not using all the escape characters () gives an error saying either
“Invalid double quote termination” or
“Variable subscription/liveMeasurement not found”

3) What is happening/not happening?
Sending external web request to: api.tibber.com/v1-beta/gql/subscriptions
+109ms ║║Error executing external web request: java.lang.reflect.UndeclaredThrowableException

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full

7.6.2019, 14:43:47 +293ms
+0ms ╔Received event [Mitt hjem].test = 1559911427292 with a delay of 0ms
+74ms ║RunTime Analysis CS > 27ms > PS > 29ms > PE > 18ms > CE
+77ms ║Runtime (38142 bytes) successfully initialized in 29ms (v0.3.10a.20190223) (75ms)
+79ms ║╔Execution stage started
+88ms ║║Cancelling statement #1’s schedules…
+112ms ║║Sending external web request to: api.tibber.com/v1-beta/gql/subscriptions
+119ms ║║Error executing external web request: java.lang.reflect.UndeclaredThrowableException
+122ms ║║Executed virtual command httpRequest (18ms)
+130ms ║║Executed virtual command setVariable (1ms)
+156ms ║║Executed virtual command sendPushNotification (19ms)
+162ms ║╚Execution stage complete. (83ms)
+164ms ╚Event processed successfully (164ms)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Does that query work when sent via other ways… like curl maybe?


#3

Here is Tibbers own example of how to use it. I just cant figure out how to format the json object within the confines of webcore.

https://developer.tibber.com/explorer