2

I am working on a project whereby I want to connect my ESP8266 (NodeMCU) to the google Firestore (not the RT-Firebase) to read / retrieve some data and maybe write something to it aswell.

I have already tried with a simple REST API GET-request but That kept on failing. Any guides, help, examples?

Here below my code of a simple Get-request that keeps on giving an error

[HTTP] GET... failed, error: connection refused
void loop() {
  if(WiFi.status()== WL_CONNECTED){


  http.begin("https://firestore.googleapis.com/v1beta1/projects/edubox-49528/databases/(default)/documents/nodes?&key=[API-KEY]");
  int httpCode = http.GET(); //Send the request
  Serial.println(httpCode);
  if (httpCode > 0) {
    String payload = http.getString(); //Get the request response payload
    Serial.println(payload); //Print the response payload
  }
  else {
    Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
  }
  http.end();
  } else {
    Serial.println("Error in WiFi connection");   
  }
  delay(10000);

}

0 Answers0