Can't write value in my thermostat


#1

Hello,

I strictly follow the documentation to do my first try. I can read values of my thermostat but i can’t write value ({“target_temperature_f”: 65}). In my oAuth client, my authorization are read/write.

My request:

POST /devices/thermostats/XXXXXXXXXXXXXX HTTP/1.1
Host: developer-api.nest.com
Content-Type: application/json
Authorization: Bearer XXXXXXXXXXX
cache-control: no-cache
Postman-Token: 2ab9c0ab-1821-4c33-b333-85c52ce5a7fb
{“target_temperature_f”: 65}------WebKitFormBoundary7MA4YWxkTrZu0gW–

what am I doing wrong ?

Thanks
Frederic


#2

Do you get an error in response when you make the call?


#3

Yes. Unauthorized. No problem when I read a value with the same id/secret/token

{
“error”: “unauthorized”,
“type”: “https://developer.nest.com/documentation/cloud/error-messages#auth-error”,
“message”: “unauthorized”,
“instance”: “4fe4cb80-c791-49ea-a45e-12b8380b11e5”
}


#4

Are you handling redirects properly, and have the correct permissions selected for the account (Thermostat Read/Write)?

https://developers.nest.com/reference/error-messages#unauthorized


#5

For redirects, it should be automatic (i use Postman for the test) and correct permissions are selected
permissions


#6

When you make the write call, are you using smart quotes for the field name? Or dumb quotes? I noticed in what you’ve posted that they appear to be smart:

“target_temperature_f”

vs dumb:

"target_temperature_f"

I believe you need to use dumb quotes.

Also if you’re using Postman, provide screenshots of what your write calls look like. If you have the right permission and can read, then you should be able to write.


#7

Hello,

When I have read your message, I hoped to do this mistake but not … my quotes are correct :frowning: I joined a screenshot


#8


#9

Hello,

nobody has an idea, I’m totally desperate.


#10

Your screenshots show “POST” as the request type (just to the left of the URL), can you try it with PUT as noted in the docs?

https://developers.nest.com/guides/api/how-to-write-data


#11

Yes you are right, I will test that.


#12

It was that … sorry for the unconvenience


#13

No worries, glad we figured it out. :slight_smile: