This page last changed on Mar 29, 2016 by learic.

I have been working on my interface with Z-Wave and decided to spice it up with some weather information. Looking at the yahooapi method via HTTP, I have decided to attempt a JSONPath Expression. When I test the data on a JSONPath Expression tester, the result comes back in a way I think is correct but I could be mistaken. I have turned on logging and the HTTP Get method seems to throw an error. Can someone else test this to see if they receive the same results? I'm using the OpenRemote Controller 2.1.1:

DEBUG 2016-03-28 21:16:07,652 (HTTP): HttpGetCommand: url = https://query.yahooapis.com/v1/public/yql?q=select%20%2A%20from%20weather%2Eforecast%20where%20woeid%20in%20%28select%20woeid%20from%20geo%2Eplaces%281%29%20where%20text%3D%22orlando%2C%20fl%22%29&format=json
DEBUG 2016-03-28 21:16:07,652 (HTTP): HttpGetCommand: jsonpath = $..channel..item..condition..text

By pasting the URL above into a web browser, I receive the following information:

..."condition":{"code":"27","date":"Mon, 28 Mar 2016 09:00 PM EDT","temp":"76","text":"Mostly Cloudy"}...

Above is truncated due to length. By clicking on the URL link above, you can see the full JSON response..

and when using the JSONPath Expression, I would receive the following information:

[
"Mostly Cloudy"
]

But, when OpenRemote Controller sends the request, I receive the following:

ERROR 2016-03-28 21:16:10,387 (HTTP): ClientProtocolException when executing HTTP method
org.apache.http.client.HttpResponseException: Bad Request
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:67)
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:54)
at org.openremote.controller.protocol.http.HttpGetCommand.requestURL(HttpGetCommand.java:238)
at org.openremote.controller.protocol.http.HttpGetCommand.run(HttpGetCommand.java:260)
at java.lang.Thread.run(Thread.java:701)
ERROR 2016-03-28 21:16:10,387 (HTTP): ClientProtocolException when executing HTTP method
org.apache.http.client.HttpResponseException: Bad Request
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:67)
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:54)
at org.openremote.controller.protocol.http.HttpGetCommand.requestURL(HttpGetCommand.java:238)
at org.openremote.controller.protocol.http.HttpGetCommand.run(HttpGetCommand.java:260)
at java.lang.Thread.run(Thread.java:701)
INFO 2016-03-28 21:16:10,401 (HTTP): received message:
ERROR 2016-03-28 21:16:10,427 (HTTP): Could not perform jsonpath evaluation
java.lang.IllegalArgumentException: json can not be null or empty
at org.apache.commons.lang.Validate.notEmpty(Validate.java:363)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:304)
at org.openremote.controller.protocol.http.HttpGetCommand.run(HttpGetCommand.java:297)
at java.lang.Thread.run(Thread.java:701)
INFO 2016-03-28 21:16:10,449 (HTTP): received message:
ERROR 2016-03-28 21:16:10,451 (HTTP): Could not perform jsonpath evaluation
java.lang.IllegalArgumentException: json can not be null or empty
at org.apache.commons.lang.Validate.notEmpty(Validate.java:363)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:304)
at org.openremote.controller.protocol.http.HttpGetCommand.run(HttpGetCommand.java:297)
at java.lang.Thread.run(Thread.java:701)
ERROR 2016-03-28 21:16:17,911 (HTTP): ClientProtocolException when executing HTTP method
org.apache.http.client.HttpResponseException: Bad Request
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:67)
at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:54)
at org.openremote.controller.protocol.http.HttpGetCommand.requestURL(HttpGetCommand.java:238)
at org.openremote.controller.protocol.http.HttpGetCommand.run(HttpGetCommand.java:260)
at java.lang.Thread.run(Thread.java:701)

Any help would be greatly appreciated.

I used this before ( URL )

http://weather.yahooapis.com/forecastrss?p=CAQC0028&u=c

now this for me

http://xml.weather.yahoo.com/forecastrss/CAQC0028_c.xml

Posted by yogs at Apr 06, 2016 02:23

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22orlando%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys

Posted by yogs at Apr 06, 2016 02:49
Document generated by Confluence on Jun 05, 2016 09:33