Hi, I got a problem with firmware upgrade through API. I need help with syntax (at least I think that it is syntax, still new to this).
Here is the code I need help with:
…
url_firmUpg = f"{baseUrl}/firmware/actions/upgrade"
header_firmUpg = {“Authorization”: f"Bearer {token}"}
data_firmUpg = {“keep_settings”: “true”}
response_firmUpg = requests.post(url=url_firmUpg,
headers=header_firmUpg,
json=data_firmUpg)
…
This is the error message:
{‘success’: False, ‘errors’: [{‘source’: ‘Validation’, ‘code’: 102, ‘error’: ‘No arguments provided for action’, ‘section’: ‘upgrade’}]}
I know that I am missing something but I can’t find what, even on Teltonika Networks website under firmware/actions/upgrade there is only this:
Ok I found what I did wrong, I used in: “requests.post(url=…, header=…, data=data_firmUpg)”, but I needed to change “data” to “json” like this: “requests.post(url=…, header=…, json=data_firmUpg)”