arduino-libraries / ArduinoHttpClient

Arduino HTTP Client library
288 stars 172 forks source link

ecobee get request with bearer token, not able to get syntax right #81

Closed andrewjohnsen31 closed 4 years ago

andrewjohnsen31 commented 4 years ago

I am another newbee, spending countless hours. :) Searching everywhere for existing Ecobee example and have not found an exact match. This example seems like the closed thing. Please see what you can do.

My Goad is to read the temperature from an ecobee thermostat. I have found this example along with a bearer token example to guide this effort. **Reference:

** https://github.com/gscales/MS-Graph-Arduino/tree/master/MSGraph-SendMail Note: token used is expired. I have a working Curl example: This works in Postman.

curl -s -H 'Content-Type: text/json' -H 'Authorization: Bearer o49bBMaRHXCcEOa5FTf5TqDcc5GxooRM' 'https://api.ecobee.com/1/thermostat?format=json&body=\{"selection":\{"selectionType":"registered","selectionMatch":"","includeRuntime":true\}\}'

Now all I need to do is get my Arduino Uno WiFi to replicate this. With the attached code Here is the response from host:

Screen Shot 2020-02-01 at 5 44 41 PM

The correct response from an expired token is:

{
  "status": {
    "code": 14,
    "message": "Authentication token has expired. Refresh your tokens. "
  }
}

ECObee_Bearer_request.txt

andrewjohnsen31 commented 4 years ago

to fix I added the full path:""https://api.ecobee.com client.post("https://api.ecobee.com/1/thermostat?");