The API to read a setting by id seems to have had a response code change recently.
https://givenergy.cloud/docs/api/v1#inverter-control-POSTinverter--inverter_serial_number--settings--setting_id--read
It used to respond with 201 as per the docs but now responds 200.
Not entirely sure this change was made.
Anyone else noticed this?
Is it a deliberate change or a mistake?
API - Read Setting - response code has changed in June/July 2025
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.