arduino-libraries / ArduinoHttpClient

Arduino HTTP Client library
288 stars 172 forks source link

Status code 200 with no response #85

Closed andrewjohnsen31 closed 4 years ago

andrewjohnsen31 commented 4 years ago

I have been using ArduinoHTTPClient to access data on my ECObee thermostat. This has worked reliably. Now I modify the Get request to add an additional parameter and I get "No Response". Repeating in Postman this Get Request works fine. Statuscode always come back as 200 for both HTTPClient and Postman.

The only thing I can think of different is the working response went from 2.19 kB (252 mS) to 6.27 kB (200 mS) of JSON Data.

Arduino Code: "No Response"

  client.beginRequest();`
  client.get("https://api.ecobee.com/1/thermostat?format=json&body={\"selection\":{\"selectionType\":\"registered\",\"selectionMatch\":\"\",\"includeWeather\":true}}");   
  client.sendHeader("Authorization", ("Bearer " + access_token));
  Serial.println("Bearer " + access_token);
  client.sendHeader("Content-Type", "text/json");
  client.endRequest();
  // ========  read the status code and body of the response  ===========
  statusCode = client.responseStatusCode();
  response = client.responseBody();

PostMan command: "Working" Get Request:

https://api.ecobee.com/1/thermostat?format=json&body={"selection":{"selectionType":"registered","selectionMatch":"","includeWeather":true}}

Any Help on how to troubleshoot this ?

I have an existing project on Arduino hub:

https://create.arduino.cc/projecthub/Andrewjohnsen31/access-your-ecobee-thermostat-using-ecobee-api-49b14b?ref=user&ref_id=1139091&offset=0

this information will be used to add more features.

Thanks for reviewing, if there is something more, please let me know.

andrewjohnsen31 commented 4 years ago

In reading, I see I need to review memory usage.

andrewjohnsen31 commented 4 years ago

In Checking available Ram: Global variables use 470 bytes (7%) of dynamic memory, leaving 5674 bytes for local variables. The Resonse expected is 6200 bytes, more than available on my Arduino UNO WiFi Rev2. My Conclusion is I don' have enough Ram. The Arduinohttpclient is not responsible for this issue. Closing issue.....