Description
at https://kno.wled.ge/interfaces/json-api/#setting-new-values The api is descibed as follows:
Sending a POST request to /json or /json/state with (parts of) the state object will update the respective values. ...
But in fact, the actual page after json does not have to be nothing or /state. It can be all json GET pages (https://kno.wled.ge/interfaces/json-api/#api) Since if "v" = true, it calls the normal serveJson(request) function which would also be called if you get a page.
This also has an effect on the documentation of "v", descibed below under section 2.
https://kno.wled.ge/interfaces/json-api/#state-object setting "v":true is described as
If set to true in a JSON POST command, the response will contain the full JSON state object.
Not included in state response
But with how the json api is implented at the moment, it:
- Reacts to any method that is not get (This is because how the handler is programmed in wled_server.cpp I believe. It firsts sets a handler for get methods to /json and then a handler for any method to /json which has the code for v:true. I believe if its a GET method, it ignores the second handler, and if not, you get the behaviour described in the documentation, except for all methods)
- It does not in fact return the full JSON State object, it returns the full object of the subpage after json. For example, for /json/state it WOULD return the full state object, but if you would call /json, you will also get the info, effects and palletes. And if you would call /json/pal with it set, you will get the palette names.
In my opinion other methods then POST working is a bug/oversight which does not really need fixing atm. I would more clearly label v with something like:
If set to true in a JSON POST command, the response will contain the full JSON object of the page requested.
Not included in state response
But perhaps V: true and post requests in general working on other subpages of json is also a bug. I dont know the intention there.