RESTful API for the rcswitch library based on node.js/express
JavaScript Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
routes
.gitignore
README.md
apiary.apib
package.json
server.js
startServer.sh

README.md

rcswitch-rest

#RESTful API for the rcswitch library based on node.js/express

For further informations and setup instructions please refer to my blog post.

##Add a new switch to the configuration curl -i -X POST -H 'Content-Type: application/json' -d '{"id": "0", "url": "/switches/0", "name": "Lamp 1", "script": "sudo /home/pi/rcswitch-pi/sendRev", "command": "B 1", "status": "0"}' http://raspberrypi:8000/switches

##Get the list of active switches curl -i -X GET http://raspberrypi:8000/switches

##Turn switch on curl -i -X PUT -H 'Content-Type: application/json' -d '{"status": "1"}' http://raspberrypi:8000/switches/0

##Turn switch off curl -i -X PUT -H 'Content-Type: application/json' -d '{"status": "0"}' http://raspberrypi:8000/switches/0

##Remove switch configuration curl -i -X DELETE http://raspberrypi:8000/switches/0