1

after reading this answer https://stackoverflow.com/a/51614256/15486192 from @Arsam, i am successfully sending data from nodeMcu esp8266 to firebase. but i am using Database secrets Although it is deprecated.

and while searching for an alternative i came across firebase REST

Firebase Database REST API

API Usage

You can use any Firebase Realtime Database URL as a REST endpoint. All you need to do is append .json to the end of the URL and send a request from your favorite HTTPS client. HTTPS is required. Firebase only responds to encrypted traffic so that your data remains safe.

after reading that, anyone conclude that you can send data to firebase using HTTPS request.

so my questions,

is REST API just an HTTP request? i am just confused if it is, then why just not naming it HTTP API? can i send my data to firebase Realtime-database using only https request from my client?if yes then how

2 Answers2

1

REST or RESTful API design (Representational State Transfer) is designed to take advantage of existing protocols. While REST can be used over nearly any protocol, it usually takes advantage of HTTP when used for Web APIs.

  • thank you sir for your answers, now i am getting a deep understanding of REST API after spending half day reading the docs on firebase. but what make me ask this question is that i was confused that REST is a platform or something huge and new like android, ios, c++, unity, javascript... because of the page layout of the documentation here https://firebase.google.com/docs/reference – Amine Still May 09 '21 at 22:29
  • Its a software architectural style, commonly used to create interactive web services. It has a collection of principals such as client–server architecture, statelessness, cacheability, use of a layered system, support for code on demand, and using a uniform interface. These principles must be followed for the system to be classified as REST. – Behnam Anjomruz May 10 '21 at 04:45
1

Be carefull when using the REST API on the client side!

The REST API for the Firebase RTDB is usualy ment for development of code where you don't wand or can't use the official SDKs. For example when you code in a language that doesn't have a official Firebase SDK. Or also in usecases where you because of perfromacne reasons don't want to use the SDKs. In most cases landing pages.

BUT. The REST API is very handy for public data in your database. And I would only recommend to leave public data only the read access. Othervise anyone could fill up your database with knowing your REST API.

So if you plan to use the RTDB on your client side try to use official SDK because the handle the security for you.

David East even had a talk on the last Google IO on how to improve the loading time for laning pages by removing the Firebase SDKs and using the REST API. But that was also only for public data.

If you want to use it on a server from the backend you can use also the REST API. Here is the documentation for using the REST API and here for the authentication part of it.

Tarik Huber
  • 7,061
  • 2
  • 12
  • 18