From ceab2f70bd5c13d34729fb2be324e6e720a22d3f Mon Sep 17 00:00:00 2001 From: noerw Date: Sat, 3 Dec 2016 11:19:56 +0100 Subject: [PATCH] switch to unencrypted API --- api.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/api.h b/api.h index bee246e..ad9c854 100644 --- a/api.h +++ b/api.h @@ -1,25 +1,18 @@ #pragma once -#include +#include #include "config.h" #include "streampipe.h" class OsemApi { protected: - WiFiClientSecure client; + WiFiClient client; public: bool postMeasurement(String measurement, String sensorID) { - if (!client.connect(API_ENDPOINT, 443)) { - return false; - } - - if (!client.verify(API_FINGERPRINT, API_ENDPOINT)) { - return false; - } - + if (!client.connect(API_ENDPOINT, 8000)) return false; + client << String("POST ") << "/boxes/" << ID_BOX << "/" << sensorID << " HTTP/1.1" << EOL; client << "Host: " << API_ENDPOINT << EOL; - client << "X-APIKey: " << API_KEY << EOL; client << "Content-Type: application/json" << EOL; client << "Connection: close" << EOL; client << "Content-Length: " << measurement.length() << EOL << EOL; @@ -29,7 +22,7 @@ class OsemApi { if (!client.connected()) return false; String line = client.readStringUntil('\r'); if (line != "HTTP/1.1 201 Created") return false; - + return true; } };