Hello,
i’m struggling to send a POST request from my Android application written in Java to the REST API of openHAB. With the API explorer i found the POST request to change the state of my switch element by calling the following command:
But i don’t know how to send the plain command given by -d “ON” inside Java. Because with all the given libraries you need to send key-value pairs as data.
The GET requests are working fine but the POST request isn’t working.
Does anyone know how to send -d “ON” in Java? Or has anyone an example?
I already found this topic but my problem is that there is always a pair of key and value is sent as data in a POST request. But with the given curl command from the API explorer there is only -d “ON” sent. And i can’t find a solution to only send these types of requests.