Search code examples
nest-api

Unreliable NEST Rest API


Right after oauthing wiht auth token, I make few api calls.

The problem is that the responses are unreliable in the sense that, at times some of the requests work as expected and at other times they don't and there is no deterministic way to find why and when it isn't working.

For instance, with the same auth token(redacted here) - I made the following api calls in different iterations and pasting the results below.

https://developer-api.nest.com/structures 

https://developer-api.nest.com/devices/smoke_co_alarms

https://developer-api.nest.com/devices/thermostats

HttpRequest(https://developer-api.nest.com/structures, GET, ,List((auth, some_auth_token)),List((User-Agent, scalaj-http/1.0), (content-Type, application/json)),List(, , ), DIRECT, UTF-8, 4096,, true)

No Response

HttpRequest(https://developer-api.nest.com/devices/smoke_co_alarms, GET, ,List((auth, some_auth_token)), List((User-Agent, scalaj-http/1.0), (content-Type, application/json)),List(, , ), DIRECT, UTF-8, 4096,, true)

Json Response


HttpRequest(https://developer-api.nest.com/structures, GET, , List((auth, some_auth_token)),List((User-Agent, scalaj-http/1.0), (content-Type, application/json)),List(, , ), DIRECT, UTF-8, 4096,, true)

Json Response


HttpRequest(https://developer-api.nest.com/devices/thermostats, GET,, List((auth, some_auth_token)),List((User-Agent, scalaj-http/1.0), (content-Type, application/json)),List(, , ), DIRECT, UTF-8, 4096,, true)

 No Response

I am fairly certain this is an issue with NEST API. Did anyone else face similar issues?

What did you do or what do you suggest I try?

  • I want to make REST API calls only - no firebase, etc
  • CURL requests from terminal for the same works consistently

Solution

  • can you use gist or pastebin? The format is hard to read.

    From OP:

    I figured out the issue. I hadn't enabled the option to follow temporary redirects and the null response was because I was only extracting the body. I completely missed that I was extracting the body content while printing the response