Proper way to store and update config via REST API
Posted: Sat May 22, 2021 3:51 pm
Hello everyone! I need to store config for my device so it can be updated easily via REST API . Now, what I do is just storing a json file like this
which I handle with ArduinoJson. To update some of the params I need to read the whole file, update desired json element and write it back. Possibly there are some better ways to do so ?
Code: Select all
Hello everyone
{
"ap_name":"myDEvice",
"ap_password":"mypassword",
"ap_maxconn": 2,
"ap_channel": 6,
"sensors":[
{
"id":"sensor1",
"pin": 0,
"threshold": 0,
...
},
{
"id":"sensor2",
"pin": 1,
"threshold": 0,
...
}
]
}
which I handle with ArduinoJson. To update some of the params I need to read the whole file, update desired json element and write it back. Possibly there are some better ways to do so ?