Reverse engineered Nest API.
Example:
curl -X PATCH \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic NEST_ACCESS_TOKEN' \
-d '{"mode":"home or away"}' \
http://nest-rest-instance-address:8080/users/NEST_USER_ID/structures/NEST_STRUCTURE_IDThe easiest way is to run it via Docker:
docker run -d --name nest-rest -p 8080:8080 emilburzo/nest-rest:latestLogin to https://home.nest.com/ and then go to https://home.nest.com/session
In the JSON response you should see a access_token and userid field, like:
{
"access_token": "b.user_id.long_string",
"userid": "user id"
}You can just send a request with a random value for the NEST_STRUCTURE_ID:
curl -X PATCH \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic NEST_ACCESS_TOKEN' \
-d '{"mode":"home or away"}' \
http://nest-rest-instance-address:8080/users/NEST_USER_ID/structures/thistotallydoesnotexistAnd you'll get back a helpful error message which contains the structure id, e.g.:
{
"status": "FAILURE",
"message": "User does not have permission to Set(STRUCTURE_thistotallydoesnotexist). Allowed resources are Set(USER_XXXXXXXXXXXXXXXX, STRUCTURE_XXXXXXXXXXXXXXXX, DEVICE_XXXXXXXXXXXXXXXX)"
}- https://github.com/derek-miller/nest-protobuf for the hard job of extracting the
.protofiles