Skip to content

Simple Web.py RESTful API, initially set up for capturing IOT smart thermostat data

License

Notifications You must be signed in to change notification settings

darwinz/webpy-restful

Repository files navigation

Web.py RESTful Thermostats API

Prerequisites

Starting the Web Service

$ # define the port the service will run on
$ port="3000" ### or some other valid port
$ python main.py ${port}

GET list all thermostats

$ port="3000"
$ curl -XGET http://localhost:${port}/v1/thermostats | python -m json.tool

POST create a new thermostat

$ port="3000"
$ id="100"
$ curl -XPOST -d '{"Name": "New Thermostat", "Operating_Mode": "off", "Fan_Mode": "auto", "Cool_Set_Point": 68, "Heat_Set_Point": 63}' http://localhost:${port}/v1/thermostats | python -m json.tool

GET search for a single thermostat

$ port="3000"
$ id="100"
$ curl -XGET http://localhost:${port}/v1/thermostats/${id} | python -m json.tool

PUT update a single thermostat

$ port="3000"
$ id="100"
$ curl -XPUT -d '{"Name": "Updated Thermostat", "Operating_Mode": "off", "Fan_Mode": "auto", "Cool_Set_Point": 69, "Heat_Set_Point": 64}' http://localhost:${port}/v1/thermostats/${id} | python -m json.tool

DELETE a single thermostat

$ port="3000"
$ id="101"
$ curl -XDELETE http://localhost:${port}/v1/thermostats/${id} | python -m json.tool

About

Simple Web.py RESTful API, initially set up for capturing IOT smart thermostat data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages