PUT API Requests take time to execute


I am creating a client for Nest Thermostats on iOS, I managed to create a REST Streaming service to listen to the changes on a thermostat. If I change any thermostat value from the Thermostat Simulator, or even the Nest Portal, everything works great, the app receives the update almost immediately.

The problem is when I write a change from my app to the API using the PUT HTTP method, it takes some time for the app to receive the changes from the API. How I can get my app writing to the API as fast as Nest Simulator and Portal does?


When using simulated devices, when you write a change using your app, do you see the change quickly in the Nest app and Nest Simulator? How long does it take for the API to see the change?


No, when writing a change from my app, the change takes about 1000 ms to take place and show the update in the Nest app and Nest Simulator.
But, when I write a change on the Nest Simulator (switching Fahrenheit to Celsius, for example), almost immediately the update shows up in my app and Nest app.


What happens if you simply try a curl PUT, like this below? In my tests using a curl command, with a virtual device, both the streaming connection and the simulator update with the result of the PUT almost immediately, in under 1 sec.

curl -L -X PUT -d ‘{“target_temperature_f”: 72}’ “https://developer-api.nest.com/devices/thermostats/<DEVICE ID REMOVED>/” -H “Authorization: Bearer <AUTHORIZATION TOKEN REMOVED>” -i

curl -L -v “https://developer-api.nest.com/devices/thermostats/<DEVICE ID REMOVED>” -H “Authorization: Bearer <AUTHORIZATION TOKEN REMOVED>” -H “Accept: text/event-stream”


Besides trying both of the curls, I also tried Postman, and the three of them take almost the same time writing to the API as my app does, which is “fast”. But still, Nest Simulator and even Nest Web app write even faster to the API. Wondering if there is a special configuration those two clients have?


The Nest Simulator and Nest Apps use a different internal API when communicating to Nest’s backend.