Openhab REST API Json

Hi

I need to send/receive JSON command through the rest api

I use the Advanced REST client, a google chrome addon, to test my commands

I can send/receive the state on the item with PUT / GET
https://demo.openhab.org:8443/rest/items/Light_FF_Bath_Mirror/state

If I open this link:
https://demo.openhab.org:8443/rest/items/Light_FF_Bath_Mirror/

I get this JSON:

{"link":"https://demo.openhab.org:8443/rest/items/Light_FF_Bath_Mirror","state":"ON","type":"Switch","name":"Light_FF_Bath_Mirror","label":"Mirror","tags":[],"groupNames":["FF_Bath","Lights"]}

Can I use this to send/receive JSON code to the item Light_FF_Bath_Mirror, and send it to https://demo.openhab.org:8443 ?

I would advise to not make it more complicate as it is. openhab uses swagger, one of the best REST API documentation and testing tool which exists IMO.

to access it, you can open https://openhab:8443/doc/index.html
there you can read how to webservice works, what methods you need to send, and the commands. mostly for sending simple commands you send it as text/plain instead of json.

I don’t know, can you?
Have you tried it? You’ll get your answer…

1 Like

I can not fugue out how to send it, so I don’t know if it works.

I have tried the link, but doesn’t help me, how I can send plain/text to the IP address with out /something/something

first you need to decide to a technology… javascript ajax request, with any server side scripting language or higher programing language making http post/get/… requests.

when you decided what you want to use, you will become help for sure