我想调用一个嵌套API来获取Arduino中使用C代码的室温。从Arduino调用嵌套API
当我打电话使用邮递员的API,我得到完美的回应:
然而,当我写的代码来获取温度数据,我得到如下回应:
请求发送 请求是HTTP/1.1 400错误请求。
这里是我的代码,任何人都可以帮我什么地方错了我的要求:
const char* ssid = "linksys";
const char* password = "XXXXX";
const char* host = "firebase-apiserver07-tah01-iad01.dapi.production.nest.com"; // "developer-api.nest.com"; // "api.github.com";
const int httpsPort = 9553; //443 9553;
String url = "";
.......
.......
.......
if (!client.connect(host, httpsPort)) {
Serial.println("connection failed");
return;
} else {
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Authorization: Bearer c.SbsgvTBcsJREMOVED_CODE_FOR_SECURITY_REASON\r\n" +
"Content-Type: application/json\r\n\r\n"
);
Serial.println("request sent");
}
感谢,
沙巴
1)请勿张贴文字的图像。 2)Arduino不是C,也不完全是C++。 – Olaf
可能因为您需要安全连接。 –