API - Read Setting - response code has changed in June/July 2025

2 comments started 2025-07-05 last 2025-10-24
APIsHome Automation
1
#2 1peter

Something has changed.
The API documentation is misleading. It says:
200 The response was successful
201 The response was successful and a resource was created
However,
In get a 201 code even when the request failed. One has to look at the 'data' key and then the 'success' key in the response. A successful response has a 201 code and shows:
{'data': {'value': '21:02', 'success': True, 'message': 'Written Successfully'}}
A unsuccessful response has a 201 code and shows:
{'data': {'value': -6, 'success': False, 'message': 'There was no response from comms. Please try again'}} or
{'data': {'value': -2, 'success': False, 'message': 'Inverter Offline'}}
I found this when wondering why an overnight start-charge instruction was ignored. My Python code checked for 200/201. I ran a small program that set the discharge-2 stop time every 15 mins for 24 hours. The program output the response code and the response data and only then could I see that checking for 200/201 was pointless, as I show above.
I'll have to change my code to pick up the 'success' key from the response data.