Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
Last active November 3, 2016 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarsBergqvist/13e0ca63b6ea34a028a893862f113121 to your computer and use it in GitHub Desktop.
Save LarsBergqvist/13e0ca63b6ea34a028a893862f113121 to your computer and use it in GitHub Desktop.
Examples on REST calls to my api that controls 433MHz remote controlled outlets via a Raspberry Pi
# Examples on REST calls to the api
# Replace localhost:5000 with the IP-address and port of the machine where the api is running
# List all defined outlets (GET)
curl -i http://localhost:5000/Outlets/api/outlets
# Turn on power for outlet 1 in group 2
curl -i -H "Content-Type: application/json" -X PUT -d '{"state":"on"}' http://localhost:5000/Outlets/api/outlets/2/1
# Turn on power for outlet 3 in group 1
curl -i -H "Content-Type: application/json" -X PUT -d '{"state":"on"}' http://localhost:5000/Outlets/api/outlets/1/3
# Turn off power for outlet 3 in group 1
curl -i -H "Content-Type: application/json" -X PUT -d '{"state":"off"}' http://localhost:5000/Outlets/api/outlets/1/3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment