Realtime Firebase

YRSALK
Posts: 1
Joined: Tue Oct 22, 2019 8:46 am

Realtime Firebase

Postby YRSALK » Tue Oct 22, 2019 9:08 am

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.

jonking
Posts: 8
Joined: Wed Dec 04, 2019 1:36 pm

Re: Realtime Firebase

Postby jonking » Fri Dec 13, 2019 7:03 pm

Hello,

Also trying to do this and not having any luck finding information. Any progress on your end?

bbulkow
Posts: 20
Joined: Wed Jan 01, 2020 1:40 am

Re: Realtime Firebase

Postby bbulkow » Sun Jan 05, 2020 1:37 am

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?

jonking
Posts: 8
Joined: Wed Dec 04, 2019 1:36 pm

Re: Realtime Firebase

Postby jonking » 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.

muhambykar
Posts: 13
Joined: Tue Oct 08, 2019 9:03 am

Re: Realtime Firebase

Postby muhambykar » Mon Feb 15, 2021 11:44 am

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

Mohammed Jasim
Posts: 1
Joined: Wed Jul 12, 2023 9:40 am

Re: Realtime Firebase

Postby Mohammed Jasim » Wed Jul 12, 2023 11:13 am

how to sent the data to firestore using espidf

Who is online

Users browsing this forum: Google [Bot] and 247 guests