Page 1 of 1
Realtime Firebase
Posted: Tue Oct 22, 2019 9:08 am
by YRSALK
Hello, I am having a hard time trying to connect my ESP32 board with a firebase: Realtime database. Reading and writing from/to database using Arduino IDE is fairly easy, But here I am confused. I would be grateful If anyone can tell me where should I start looking in the Guide.
Thanks.
Re: Realtime Firebase
Posted: Fri Dec 13, 2019 7:03 pm
by jonking
Hello,
Also trying to do this and not having any luck finding information. Any progress on your end?
Re: Realtime Firebase
Posted: Sun Jan 05, 2020 1:37 am
by bbulkow
Firebase uses HTTP posts of JSON data. The ESP-IDF system does have both JSON and HTTP.
Have you hooked up the HTTP server and gone through the examples? Same with JSON? Then followed the guides regarding how to format your JSON and HTTP URI for Firebase?
Arduino always has more users so will have better guides, but so far, everything I've found in ESP-IDF is there, one just has to do more work to wire things together --- but then you get to write the guide?
Re: Realtime Firebase
Posted: Thu Jan 16, 2020 9:27 pm
by jonking
Hello all,
I have been able to now get data from my firebase database. Use this function:
Code: Select all
void fetch(char *url, struct FetchParms *fetchParms)
{
esp_http_client_config_t clientConfig = {
.url = url,
.event_handler = clientEventHandler,
.user_data = fetchParms};
esp_http_client_handle_t client = esp_http_client_init(&clientConfig);
esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK)
{
ESP_LOGI(TAG, "HTTP GET status = %d",
esp_http_client_get_status_code(client));
}
else
{
ESP_LOGE(TAG, "HTTP GET request failed: %s", esp_err_to_name(err));
}
esp_http_client_cleanup(client);
}
and use the HTTP call:
https://firestore.googleapis.com/v1/pro ... /cities/LA
You can use the Postman application to do test HTTP get calls.
Let me know if you have any questions.
Re: Realtime Firebase
Posted: Mon Feb 15, 2021 11:44 am
by muhambykar
jonking wrote: ↑Thu Jan 16, 2020 9:27 pm
Hello all,
I have been able to now get data from my firebase database. Use this function:
Code: Select all
void fetch(char *url, struct FetchParms *fetchParms)
{
esp_http_client_config_t clientConfig = {
.url = url,
.event_handler = clientEventHandler,
.user_data = fetchParms};
esp_http_client_handle_t client = esp_http_client_init(&clientConfig);
esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK)
{
ESP_LOGI(TAG, "HTTP GET status = %d",
esp_http_client_get_status_code(client));
}
else
{
ESP_LOGE(TAG, "HTTP GET request failed: %s", esp_err_to_name(err));
}
esp_http_client_cleanup(client);
}
and use the HTTP call:
https://firestore.googleapis.com/v1/pro ... /cities/LA
You can use the Postman application to do test HTTP get calls.
Let me know if you have any questions.
Hi jonking, I am interested in working about firebase realtime database & ESP-IDF, But I stuck. can you publish an example about it ?
Thank you
Re: Realtime Firebase
Posted: Wed Jul 12, 2023 11:13 am
by Mohammed Jasim
how to sent the data to firestore using espidf