[SOLVED] Http/1.1 404 not found

Hi,
In my code, I have specified two variables and one token. The problem is, it does not post in the ubidots when I upload my code and it prints ‘HTTP/1.1 404 NOT FOUND’ error in my serial monitor. What is the problem?

String token = “TOKEN”;
String heartidvariable = “56d40xbd76251238e162d1XX”;
String THIidvariable = “56d85376762542544d9aa0XX”;

save_value(String(BPM),String(THI));
if (mySerial.available())
Serial.write(mySerial.read());

void save_value(String BPM, String THI)
{

int num;
String le;
String var;

var="[{“variables”:" + heartidvariable + “, “Heart Rate”:” + BPM + “}, {“variables”:” + THIidvariable + “, “Stress Level”:” + THI + “}]”;

num = var.length();
le = String(num);
for(int i = 0;i<1;i++)
{

mySerial.println("AT+CGATT?");                                                   //this is made repeatedly because it is unstable
delay(2000);
ShowSerialData();

}
mySerial.println(“AT+CSTT=“diginet””); //replace with your providers’ APN
delay(1000);
ShowSerialData();
mySerial.println(“AT+CIICR”); //bring up wireless connection
delay(2000);
ShowSerialData();
mySerial.println(“AT+CIFSR”); //get local IP adress
delay(2000);
ShowSerialData();
mySerial.println(“AT+CIPSPRT=0”);
delay(2000);
ShowSerialData();
mySerial.println(“AT+CIPSTART=“tcp”,“things.ubidots.com”,“80"”); //start up the connection
delay(2000);
ShowSerialData();
mySerial.println(“AT+CIPSEND”); //begin send data to remote server
delay(3000);
ShowSerialData();
mySerial.print(“POST /api/v1.6/collections”);
delay(100);
ShowSerialData();
mySerial.println(”/values HTTP/1.1");
delay(100);
ShowSerialData();
mySerial.println(“Content-Type: application/json”);
delay(100);
ShowSerialData();
mySerial.println("Content-Length: "+le);
delay(100);
ShowSerialData();
mySerial.print("X-Auth-Token: ");
delay(100);
ShowSerialData();
mySerial.println(token);
delay(100);
//mySerial.println(THItoken);
//delay(100);
ShowSerialData();
mySerial.println(“Host: things.ubidots.com”);
delay(100);
ShowSerialData();
mySerial.println();
delay(100);
ShowSerialData();
mySerial.println(var);
delay(100);
ShowSerialData();
mySerial.println();
delay(100);
ShowSerialData();
mySerial.println((char)26);
delay(5000);
mySerial.println();
ShowSerialData();
mySerial.println(“AT+CIPCLOSE”); //close the communication
delay(1000);
ShowSerialData();
}

void ShowSerialData()
{
while(mySerial.available()!=0)
Serial.write(mySerial.read());
}

SOLVED!
The problem was this line:

var="[{“variables”:" + heartidvariable + “, “Heart Rate”:” + BPM + “}, {“variables”:” + THIidvariable + “, “Stress Level”:” + THI + “}]”;

The ‘Heart Rate’ and ‘Stress Level’ need to be changed to ‘value’.

1 Like