Hi!
Can anyone help me out with this code, I can't send it as a string.
I get a "cannot convert 'string to 'init' in initialization" error
the highlighted area is "int httpCode = restpost;"
String restpost = String("{"type":normal,"earliest":2017-01-01T12:00:00,"latest":2100-01-01T12:00:00,"priority":0,"robot_id":0,"mission_id":dc08d14d-3d77-11ea-817c-f44d3061dc08,"creator_id":1}");
void loop(){
while (!(httpCode == 200)){
WiFiClient client;
HTTPClient http;
http.begin(client, "http://192.168.1.27/api/v1.0.0/orders");
http.addHeader("Content-Type", "application/json");
Serial.println("[HTTP] Posting order...\n");
int httpCode = restpost;
String response =http.getString();
Serial.print("StatusCode: ");
Serial.println(httpCode);
Serial.print("Response: ");
Serial.println(response);
delay(500);
}
}
Best regards
Term