[quote=“freaktechnik, post:6, topic:77403, full:true”]
The curl for the request you’re trying to do would probably look like
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-X PUT -d '{"switch":true}' \
--insecure --silent \
http://<my_ip>:8888/1/properties/switch
This worked in terminal.
with the MozExtension ‘RESTer’ I had to work it out.
It turns out that it does not need the --insecure --silent
line at all.
curl -X PUT http://<my_ip>:8888/1/properties/switch \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"switch":false}'
This works for simple tests!
Thanks a lot!
This is the Node-Red sample flow of the above example:
[{"id":"87958e3e.960a98","type":"http request","z":"ecf5db33.a01038","name":"","method":"PUT","ret":"txt","paytoqs":"ignore","url":"http://<my_ip>:8888/1/properties/switch","tls":"","persist":false,"proxy":"","authType":"basic","x":1210,"y":760,"wires":[["96f9980.663b468"]]},{"id":"66bc516.fe65cb","type":"inject","z":"ecf5db33.a01038","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"switch\":true}","payloadType":"json","x":790,"y":740,"wires":[["dff5f673.30b9a8"]]},{"id":"96f9980.663b468","type":"debug","z":"ecf5db33.a01038","name":"Response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1400,"y":760,"wires":[]},{"id":"676e4c1e.867cbc","type":"inject","z":"ecf5db33.a01038","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"switch\":false}","payloadType":"json","x":780,"y":780,"wires":[["dff5f673.30b9a8"]]},{"id":"dff5f673.30b9a8","type":"function","z":"ecf5db33.a01038","name":"","func":"msg.headers = {};\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json';\nmsg.body = msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1020,"y":760,"wires":[["87958e3e.960a98"]]}]