Writing structs through REST API
Hi,
I have a python3 application running where I use REST API to communicate with the RTM. I've got everything working except for writing variables which are a struct variable. Reading variables (including structs) does work, so does writing non-struct variables.
For writing variables i use a POST method:
While I debug and run, the arguments would end up with these values:
url: 'https://192.168.100.125/_pxc_api/api/variables/'
headers: {'Authorization': 'Bearer 64ef2acc6444b9ee'}
data: '{"variables": [{"path": "Arp.Plc.Eclr/test", "value": {"i1": 0, "i2": 33}}]}'
The request method will answer with this response:
{'Server': 'nginx', 'Date': 'Thu, 19 Dec 2019 14:14:36 GMT', 'Content-Type': 'application/json', 'Content-Length': '198', 'Connection': 'keep-alive', 'Status': '200 OK', 'Cache-Control': 'no-cache'}
b'{"apiVersion":"1.2.0.0","projectCRC":323846263,"userAuthenticationRequired":true,"variables":[{"path":"Arp.Plc.Eclr/test","value":{"i1":0,"i2":0},"uri":"/_pxc_api/api/variables/Arp.Plc.Eclr/test"}]}'
The response says ok, but the values have not updated
The following is the value of the data argument for a non-struct integer variable which does work:
'{"variables": [{"path": "Arp.Plc.Eclr/alive", "value": 33}]}'
Is it possible to update struct variables that way?
Comments
I will see if we have this planed as a feature at the moment.
kind regards,
Oliver