optimize printing, add release profile

This commit is contained in:
2018-09-24 12:10:09 +02:00
parent 4c49d2660e
commit 88558532ee
6 changed files with 76 additions and 24 deletions

43
api.md
View File

@@ -1,10 +1,18 @@
# API
Two API architectures are supported: WebSocket and REST.
Both can be used with the same set of fields.
Everything is propagated to the mesh network automatically.
As everything can be controlled with topics, only two fields are required:
As everything can be controlled with topics, only a few fields are required:
| Field | Type | Description |
| ----- | ---- | ---- |
| topic | String | Topic where the payload is dispatched |
| payload | String | Payload to be dispatched |
| broadcast | Integer | Where to send the payload; 0 = local, 1 = broadcast |
- topic
- payload
- broadcast
## Topics
All functionality can be used by sending messages to these topics.
@@ -35,5 +43,32 @@ Example:
Content-Type: application/x-www-form-urlencoded
POST /pixel/api
Request: Form post with topic and payload as fields
Response: 200 + JSON message that was used to notify the topics
Response: 200 + final payload as JSON
Examples:
```shell
# set color by wheel
curl -v -X POST \
--data "topic=pixels/colorWheel" \
--data "payload=20" \
http://illucat/pixel/api
# set color only on current node
curl -v -X POST \
--data "topic=pixels/colorWheel" \
--data "payload=20" \
--data "broadcast=1"\
http://illucat/pixel/api
# set brightness
curl -v -X POST \
--data "topic=pixels/brightness" \
--data "payload=10" \
http://illucat/pixel/api
# run rainbow pattern
curl -v -X POST \
--data "topic=pixels/pattern" \
--data "payload=1" \
http://illucat/pixel/api
```