I was trying to connect with server but, I was unable to post the data. I have added the SSL key to connect with server that is happening but HTTPS POST is not. I tried the same method with http, I am able to connect with server in that case.
/* set SSL/TLS certificate */
client.setCACert(ca_cert);
//////////////////////////////// try to connect to server again and POST the data on the cloud //////////////////////////
if (!client.connect(host, httpsPort)) {
Serial.println("Connection failed!");
} else {
Serial.println("Connected to server!");
client.println("POST /devices/deviceData HTTP/1.1");
client.println("Host: api.thi***i.io");
client.println("cache-control: no-cache");
client.println("Content-Type: application/json");
client.println("Authorization: Bearer eyJ0e***");
client.println("Postman-Token: b1f4e147-8d13-4a27-a1a9-b****");
client.print("Content-Length: ");
client.println(PostValue.length());
client.println();
client.println(PostValue);
}
Serial.print("Waiting for response ");
while (client.available() == 0) {
if (millis() - timeout > 50000) {
Serial.println(">>> Client Timeout !");
client.stop();
return;
}
}
Serial.println("Response From Server");
while(client.available()) {
char c = client.read();
Serial.write(c);
}
It should connect from my logic but I am getting server error 400. Can I know, what can be issue here?
I was trying to connect with server. But, I was unable to post the data.
.... please clarify you post – jsotola Dec 16 '18 at 19:49