i'm working on an iot project with the ESP8266 wifi module. I've been able to successfully connect it to the internet and make an GET request to a html page using this tutorial provided by adafruit. but I seem to be having difficulties integrating it with the api endpoints that I have running on the google developer console.
Here's the potion of the code i'm having problems with
const char* Host = "www.my_app_id.appspot.com";
String PostData = "clientId=&fanId=&kueliiKey=";
String url = "/_ah/api/fan/v1/register?";
Serial.print("Requesting URL: ");
Serial.println(url);
//Connect to the client and make the api call
if (client.connect(Host, httpPort)) {
client.println("POST " + url + " HTTP/1.1");
client.println("Host: "+ (String)Host);
client.println("User-Agent: Arduino/1.0");
client.println("Connection: close");
client.print("Content-Length: ");
client.println(PostData.length());
client.println();
client.println(PostData);
delay(500);
}
//Read all the lines of the reply from server and print them to Serial
while (client.available()) {
String line = client.readStringUntil('\r');
Serial.print(line);
}
//Serial.println();
Serial.println("closing connection");
I'm able to connect but I keep on getting a 404 error
lloc\umm_malloc.c
HTTP/1.1 404 Not Found
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Tue, 22 Mar 2016 12:08:06 GMT
Vary: X-Origin
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Connection: close
Not Found
closing connection;
What I have in
String url = "/_ah/api/fan/v1/register?";
might be wrong, but I've double checked and using http://hurl.it and the api call works and returns what I want image of successful request any insight on this would be greatly appreciated.
Thanks.