Openweather NANO 33 IOT call issue

I use the following on an ESP32 to retrieve the weather data.


String httpGETRequest(const char* fullURL) {
  String payload = "{}";
  WiFiClient client;
  HTTPClient http;

  http.begin(client, fullURL);
  int httpResponseCode = http.GET();
  if (httpResponseCode == 200) {
    payload = http.getString();
  } else {
    Serial.print("HTTP Response code: ");
    Serial.println(httpResponseCode);
  }
  http.end();
  return payload;
}
1 Like