35 lines
708 B
ReStructuredText
35 lines
708 B
ReStructuredText
SpejsIoT REST API documentation
|
|
===============================
|
|
|
|
Source of this application is available at:
|
|
http://code.hackerspace.pl/informatic/spejsiot-api
|
|
|
|
Resources
|
|
---------
|
|
|
|
.. autoflask:: main:app
|
|
:undoc-static:
|
|
|
|
|
|
Example usage
|
|
-------------
|
|
|
|
.. sourcecode:: python
|
|
|
|
import requests
|
|
|
|
API = 'http://spejsiot.waw.hackerspace.pl'
|
|
|
|
# Get current device status
|
|
info = requests.get(API + '/api/1/devices/exhaust/').json()
|
|
print(info)
|
|
|
|
# Set negated relay state
|
|
requests.put(
|
|
API + '/api/1/devices/exhaust/relay/on',
|
|
json={'value': not info['relay']['on']})
|
|
|
|
# Show modified device status
|
|
print(requests.get(API + '/api/1/devices/exhaust/').json())
|
|
|