REST/HTTP call

Have a look into the following post to see an example of a more complex request from a OH rule:

For a simple call with get parameters sendHttpGetRequest(httpRequest) should be enough:

    val yahooWeatherLocationId = "782306"
    val httpRequest = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%3D" + yahooWeatherLocationId + "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"
    val String yahooWeatherJSON = sendHttpGetRequest(httpRequest)

with kind regards,
Patrik

1 Like