I can retrieve data for id=1 using a web browser:
- http://192.168.11.235/feed/value.json?id=1
Or, I can retrieve data for id=2 using a web browser:
- http://192.168.11.235/feed/value.json?id=2
However using the ESP32 only when id=1 does it give me correct data (when I un-comment line 4 below)
But, if I un-comment line 5 (line 4 is commented out) then I get a 406 error:
{"success":false,"message":"406 Not Acceptable. Route not found"}
Now this is just my example, I have id's that go up to 46 and they all work in a web browser but only id=1 works with the code below running on my ESP.
Does anyone know what my problem might be?
- void loop() {
- if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
- HTTPClient http;
- //http.begin("http://192.168.11.235/feed/value.json?id=1"); // THIS ONE WORKS
- //http.begin("http://192.168.11.235/feed/value.json?id=2"); // THIS ONE FAILS
- int httpCode = http.GET(); // get 406 Not Acceptable. Route not found"
- if (httpCode > 0) { //Check for the returning code
- String payload = http.getString();
- Serial.println(httpCode); // 200 which is for OK response
- Serial.println(payload); // data
- }
- else {
- Serial.println("Error on HTTP request");
- }
- http.end(); //Free the resources
- }
- delay(10000);
- }