stackjlei stackjlei - 1 year ago 93
reST (reStructuredText) Question

what are the differences between rest api setup and other setups on firebase?

I'm learning to work with Firebase and want to understand the differences of setting up their cloud database. From the docs, you can connect to this db through the following:






I understand that the top three is setting up the devices and desktop to connect, and I'm pretty sure that server setup means that you can ping your server from the client, and then the server will reach into firebase and then get some info for you. So what is REST API? Is that just something that makes it easier for you to connect to the database so that you can have more clear endpoints through which you can read/write/update/delete to rather than making long ajax calls?

Answer Source

With the first four options (iOS, Android, Web and Server), you download the Firebase SDK and use that to connect to the database. So in each case you have a library from Firebase that handles the connection, synchronization and that builds a client-side presentation of the data model.

When you're using the REST API, you're directly talking to the Firebase Database from your client. One advantage is that this works from any platform than can make HTTP calls. A disadvantage is that you don't have an SDK, so you will have to write all client-side code to handle the connection and data synchronization.

The simplest example of the REST API is always to find a piece of data in your database. You can find the URL of that data at the top of the Database panel in the Firebase Console, for example Now if I add .json at the end of that path, I get the full URL for the REST API for that data:

If I open this URL in a browser tab, it fires a HTTP GET request and retrieves data:


That is the JSON data in that path of my database.

To learn how to use the REST API to manipulate the data, read the Firebase documentation:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download