Firebase Realtime Database via REST API

Encountered an issue with using GET (all) and Firebase Realtime Database via REST API direct integration.

I keep getting an error via the DATA CONFIGURATOR test for GET (all) … any ideas?

Here’s the setup for GET (all) …

I’ve gotten GET (one), PUT, and DELETE to work via the DATA CONFIGURATOR test … here’s the setup for GET (one) …

Thanks … Ron :slight_smile:

1 Like

Composer currently requires the GET (ALL) route to return an array of data, so maybe there’s a Firebase config option to return it as an array? You’d want a response like

[
  {
    "id": "One",
    "color": "#ed7c5a",
    "desc": "",
    "type": "personal",
    "url": ""
  },
  {
    "id": "Three",
    "color": "#ed7c5a",
    "desc": "",
    "type": "personal",
    "url": ""
  }
]
1 Like

Thanks @Harri_Sarsa

I was able to get the GET (all) to work by setting the keys in Firebase to numbers.

Here’s an image from Firebase …

It now returns an array.

It’s a bit of a pain that if there is a gap in the numbers, a null entry is returned in the array. So I just need to keep track of the number of entries in the database to avoid gaps in the data.

Originally I was using the Cloud Firestore but switched to the Realtime Database.

The main reason for the switch was that the auth keys in the HTTPS calls to Cloud Firestore requires the OAuth SDK. I think we need to wait until AppGyver builds the intergration for Firebase Auth.

However, with the Realtime Database REST API, I can pass the auth keys from the Firebase Auth REST API.

So if anyone is trying to use Firebase for both Auth and Data. The combination that I have been able to get working is …

  1. Firebase Auth REST API … used for user login and managing the access keys … https://firebase.google.com/docs/reference/rest/auth/

  2. Realtime Database REST API … used for storing data securely using database rules … https://firebase.google.com/docs/database/rest/retrieve-data

Ron :slight_smile:

1 Like

Ron,

The Response key path for GET (all) has to be set to “documents” (without the quotes) in order to extract as an array.

Hi @Eduardo_Jaramillo

The Response key path for GET (all) has to be set to “documents” (without the quotes) in order to extract as an array.

I would need to use the response key “documents” if I was using a Cloud Firestore database.

However, I switched to a Firebase Realtime Database which has a different database schema.

As long as I set the keys in the Firebase Realtime Database to numbers, the GET (all) function is working.

2 Likes

I must say this is so frustrating that appgyver would not build a solution for one of the most popular databases. I cannot change my nodes to integers because existing apps rely on them. Why would appgyver not allow us to return the data any way it gets returned and then allow us to work with it?