Firebase firestore nested collections

How can firestore nested collections be configured as a data resource? I tried nest property types List of Object to access the Document fields in the sub collection but could not get it to work

Hi, I posted an example configuration here.

Hi.

Thanks for the reply but the example is not having firebase “nested” collections.

1 Like

Hi @Tommy_Bystrom, the UI doesn’t yet support integrating to subcollections, that’s why my example was using an array structure instead. At this point, you could integrate to a subcollection by creating a REST API direct integration from the Data configurator, using the document ID as a URL placeholder.

Hi,

Okey, thank you. I know it is possible using REST API but was hoping for a more direct way of solving it. The data can not be rearranged because it is an existing webapplication that has been in use by our customer already 3 years. Am only looking for an easy way to make an android-app for his end-customers, it would add value to the whole solution and his business.

Hi Tommy_Bystrom,
as your question points exactly to what I would like to achieve as well: can you please post e.g. a screenshot how you are solving this now with REST API ?

thank you for the descriptions so far @Tommy_Bystrom ; @Mari

According to my understanding the steps should be like this:

Do you understand this error?

You need to set Response Key Path = documents in the GET COLLECTION (GET) Config tab

Thank you, @JOHN_WORSHAM

your advice works fine! :grinning:

image

Thank you all for the input to this topic. I not yet decided if I will try to make the app using REST API or not I was hoping they would have implemented support for subcollections and also since there does not seam to be support for the firebase realtime updates it seams this is not ready yet for Apps with firebase as a backend.

Hi John,
you helped me already a lot on how to configure the GET COLLECTION for a sub-collection on Firestore and it works just fine :+1:

Now I am stumbling about difficulties with the PUT and POST:

Let’s have a look on POST; this is what I received when trying my best:

This is how I have set up the object for the test:

and a look on the configuration:


also tried the configuration with “documents” (as it solved the issue with for GET)
image

Can you help please? I am lost in what firestore requires to comunicate with AppGyver here…

To create a record use HTTP request flow function. Set HTTP method to either post or PATCH (that one to create document setting your own ID). At body variable type in json format accordingly.

Alan, thank you for the hint; still the ‘HTTP Request flow function’ seems to be more complicated and manual work.
I would realy like to get it working with the AppGyver-Data-Configurator.

Luckily I was able to get most of it going by following the docs (yes, it is worthwile to search these again and again :slight_smile: ): Google Firestore REST API integration - Composer
(special thanks tho the author @Eduardo_Jaramillo :+1:)

Now I can use GET, POST and DELETE :+1:

BUT:
it does not describe how to get PUT running :sweat:

For PUT it does not work yet: :worried:

For DELETE (and also GET and POST) it works fine: :star_struck:

  • What is missing?
  • Does anybody understand the error-message “Error: TypeError: Failed to fetch. Does the server allow CORS?status: undefined” ?
  • How to set up PUT for a firestore sub-collection correctly?

Hi Stayfoolish,
There is no PUT method in Firestore (see Cloud Firestore API  |  Google Cloud)

Eduardo

That is strange because Firebase Realtime Database accepts PUT.

Thank you for clarifiying, @Eduardo_Jaramillo and @JOHN_WORSHAM ,

now, with the understanding that

  • the PUT method does not exist for Firestore and
  • therefor of course also the data-configurator can not make use of the PUT method in this case

→ I followed @Alan_Alves advice to use the ‘HTTP request’ flow function. It works fine and isn’t as complicated as I feared before. Thanks a lot, Alan!

Here is a screenshot for PATCH to firestore:

1 Like

Thank You @stayfoolish This helped a lot.

1 Like

Should be mentioned to the screenshot above:

  • the header can stay empty (=default), if no security rules restrict the access to this section in firebase.
  • of course it is advisable to set up security rules (at least to: … allow read, write: if request.auth != null; ) and authorize the PATCH request in the header with:
    Authorization → Bearer idToken
1 Like