I am using an Opta connected to arduino cloud over wifi and cannot get http requests to function properly. What is the correct JSON supposed to look like in order to change property values?
I am starting with the relay template. The arduino cloud dashboard that comes with the template works perfectly and controls my Opta over wifi without issue so I know that I am connected and everything is working.
I have successfully partitioned my Opta and am coding in the Arduino IDE
I followed the Rest API guide https://docs.arduino.cc/arduino-cloud/api/arduino-iot-api/ and have gotten the auth token to work. I am even getting proper 200 responses to my calls indicating that everything should have worked.
I cant figure out how to actually change the property value though and the api docs dont seem to indicate how to do so. I am trying to use the propertiesV2Update endpoint
- even though the variable type says Boolean in arduino cloud, that type is not accepted in the propertiesV2update
- I am getting 200 responses but never successfully updating the value of the variable with the API call
here is an example call and response:
POST https://api.arduino.cc/iot/v1/things/<redacted>/properties/<redacted>
POST /iot/v1/things/<redacted>/properties/<redacted> HTTP/1.1
Accept: application/vnd.arduino.property+json,application/vnd.goa.error+json
Content-Type: application/json,application/x-www-form-urlencoded
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2FwaTIuYXJkdWluby5jYy9pb3QiLCJhenAiOiJWTVdSZiN3d0ZMTWsxd282bEZnd254ZEtvUmZ2UXpLYiIsImV4cCI6MTcwNzEwNDU4NCwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIiwiaHR0cDovL2FyZHVpbm8uY2MvY2xpZW50X2lkIjoiQ2FyX1dhc2hfT3B0YSIsImh0dHA6Ly9hcmR1aW5vLmNjL2lkIjoiODE0NDg4MzgtMjVjZC00MDhjLTk0OTItZjk5NmM5NTRiNDYzIiwiaHR0cDovL2FyZHVpbm8uY2MvcmF0ZWxpbWl0IjoxLCJodHRwOi8vYXJkdWluby5jYy91c2VybmFtZSI6ImRhdmlzX3NhbHR6Z2l2ZXIiLCJpYXQiOjE3MDcxMDQyODQsInN1YiI6IlZNV1JmI3d3RkxNazF3bzZsRmd3bnhkS29SZnZRektiQGNsaWVudHMifQ.mEUa1SeWM67lQwiUYqzcHICr7Gr-xaruMnyTizBdjF4
User-Agent: PostmanRuntime/7.36.1
Cache-Control: no-cache
Postman-Token: 126f4def-c64e-4cfd-a394-b0f175b08263
Host: api.arduino.cc
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
{
"name": "relay0",
"type": "STATUS",
"permission": "READ_WRITE",
"update_strategy": "ON_CHANGE",
"value": "true"
}
HTTP/1.1 200 OK
Date: Mon, 05 Feb 2024 03:38:44 GMT
Content-Type: application/vnd.arduino.property+json
Content-Length: 504
Connection: keep-alive
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache
Vary: Origin
{"created_at":"2024-02-04T23:25:39.771123Z","href":"/iot/v1/things/<redacted>/properties/<redacted>","id":"<redacted>","linked_to_trigger":false,"name":"relay0","permission":"READ_WRITE","persist":true,"tag":2,"thing_id":"redacted","thing_name":"Relay template","type":"STATUS","update_parameter":0,"update_strategy":"ON_CHANGE","updated_at":"2024-02-05T03:38:44.624356Z","variable_name":"relay0"}
1 post - 1 participant