mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-15 09:48:21 +01:00
optimize printing, add release profile
This commit is contained in:
43
api.md
43
api.md
@@ -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
|
||||
```
|
||||
Reference in New Issue
Block a user