Updated JSON API (markdown)

master
Aircoookie 2019-03-25 16:26:43 +01:00
rodzic 81c404f6db
commit 0a9dcb626b
1 zmienionych plików z 42 dodań i 28 usunięć

@ -1,6 +1,20 @@
Check back soon! This documentation is scheduled to be completed before the 3rd of April 2019 Check back soon! This documentation is scheduled to be completed before the 3rd of April 2019
Sample JSON API response (v0.8.4) Starting from version 0.8.4, WLED implements a powerful JSON API over HTTP.
It is accessable using the `/json` subpage.
### Obtaining light information
Sending a GET request will return an object similar to the sample below.
The response consists of four objects:
- `state` contains the current state of the light. All values may be modified by the client (see below)
- `info` contains general information about the device. No value can be modified using this API.
- `effects` contains an array of the effect mode names
- `palettes` contains an array of the palette names
### Setting new values
Sending a POST request to `/json/state` with (parts of) the state object will update the respective values.
Sample JSON API response (v0.8.4):
```json ```json
{ {
@ -11,32 +25,32 @@ Sample JSON API response (v0.8.4)
"ps": -1, "ps": -1,
"pl": -1, "pl": -1,
"nl": { "nl": {
"on": false, "on": false,
"dur": 60, "dur": 60,
"fade": true, "fade": true,
"tbri": 0 "tbri": 0
}, },
"udpn": { "udpn": {
"send": false, "send": false,
"recv": true "recv": true
}, },
"seg": [{ "seg": [{
"start": 0, "start": 0,
"stop": 20, "stop": 20,
"len": 20, "len": 20,
"col": [ "col": [
[255, 160, 0, 0], [255, 160, 0, 0],
[0, 0, 0, 0], [0, 0, 0, 0],
[0, 0, 0, 0] [0, 0, 0, 0]
], ],
"fx": 0, "fx": 0,
"sx": 127, "sx": 127,
"ix": 127, "ix": 127,
"pal": 0, "pal": 0,
"sel": true, "sel": true,
"rev": false, "rev": false,
"cln": -1 "cln": -1
}] }]
}, },
"info": { "info": {
"ver": "0.8.4", "ver": "0.8.4",
@ -61,7 +75,7 @@ Sample JSON API response (v0.8.4)
"opt": 127, "opt": 127,
"brand": "WLED", "brand": "WLED",
"product": "DIY light", "product": "DIY light",
"btype": "dev", "btype": "src",
"mac": "60019423b441" "mac": "60019423b441"
}, },
"effects": [ "effects": [