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
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
{
@ -11,32 +25,32 @@ Sample JSON API response (v0.8.4)
"ps": -1,
"pl": -1,
"nl": {
"on": false,
"dur": 60,
"fade": true,
"tbri": 0
},
"udpn": {
"send": false,
"recv": true
},
"seg": [{
"start": 0,
"stop": 20,
"len": 20,
"col": [
[255, 160, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]
],
"fx": 0,
"sx": 127,
"ix": 127,
"pal": 0,
"sel": true,
"rev": false,
"cln": -1
}]
"on": false,
"dur": 60,
"fade": true,
"tbri": 0
},
"udpn": {
"send": false,
"recv": true
},
"seg": [{
"start": 0,
"stop": 20,
"len": 20,
"col": [
[255, 160, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]
],
"fx": 0,
"sx": 127,
"ix": 127,
"pal": 0,
"sel": true,
"rev": false,
"cln": -1
}]
},
"info": {
"ver": "0.8.4",
@ -61,7 +75,7 @@ Sample JSON API response (v0.8.4)
"opt": 127,
"brand": "WLED",
"product": "DIY light",
"btype": "dev",
"btype": "src",
"mac": "60019423b441"
},
"effects": [