I am trying to update a variable in the arduino iot cloud using the API. I am programming an esp32 module (programmed using Arduino IDE) to talk to the iot cloud api. Here is the relevant code:
http2.begin("http://api2.arduino.cc/iot/v2/things/{thing id}/properties/{property id}/publish");
http2.addHeader("Content-Type", "application/x-www-form-urlencoded");
http2.addHeader("Authorization", "Bearer " + mytoken);
httpcode = http2.PUT("{'value': 1}");
I get the following response:
{"id":"trdsBfai","code":"bad_request","status":400,"detail":"failed to decode request body with content type "application/x-www-form-urlencoded": {'value': 1} doesn't exist in app.propertyValue"}
I suspect there is something wrong with the http payload, but I am unsure how to format it. How is the api currently interpreting my payload? Any suggestions?