跳到主要内容

Firebase

Firebase is a comprehensive platform provided by Google that offers a wide range of tools and services for developing and managing web and mobile applications. It provides developers with a scalable and secure backend infrastructure, along with a suite of pre-built features and functionalities to accelerate the development process. With the integration of Firebase on ILLA Cloud, developers can enhance their applications with reliable and scalable storage solutions, enabling them to focus on building innovative and data-driven experiences.

Create Firebase API

There are two ways to create a resource in Illa after signing into your Illa account.

  • Create in Resources

Sign in to your Illa account, select **Resources** on the top of the page, and click **Create New** button.

external_resource

Select Firebase from the API list.

action_list

Connect to the database with the required parameters described in Connection Settings below.

Click **Test Connection** to see if we can successfully connect to the database. If yes, click Save Resources, else, double check the hostname, port, username, and password is correct.

After creating a resource, the ready Firebase will display as shown.

firebase_ex_ready

  • Create in Builder

Sign into your Illa account, create a project in Illa Builder on the **App** page, and navigate to the Action List at the bottom of the page. Click **new**, then select Firebase from the database list. Then, connect to the database with the required parameters described in Connection Settings below.

Click **Test Connection** to see if we can successfully connect to the database. If yes, click Save Resources, else, double check the hostname, port, username, and password is correct.

Connection Settings

Here we need to provide information for connecting to Firebase API.

firebase_config

PropertiesRequiredDescription
NamerequiredThe name for resource when creating actions in the ILLA.
Firebase Database URLoptionalthe endpoint or URL where the Firebase Realtime Database is hosted
Firestore Project IDoptionala unique identifier assigned to each Firebase project that uses the Firestore database service
Private Keyrequireda security credential used for authenticating and accessing Firebase services programmatically

Create Actions

We have created a Firebase resource, we can add the action by selecting Firebase from the action list and choosing the Create action button.

firebase_resource_list

Now we have added the Firebase server as an action to our building page.

firebase

Configure Firebase

Overview

Service TypeFirebase AuthFirestoreRealtime Database
Action TypeGet user by UIDQuery Firebase,Query Database
Get user by emailInsert DocumentSet data
Get user by phone numberUpdate DocumentUpdate data
Create a userGet document by IDAppend data to a list
Update a userDelete a Document
Delete a userGet Collections
List userQuery Collection Group
Transformertransforming data into the style you like using JavaScript

Get user by UID

retrieve user information by specifying the user's unique identifier (UID). It enables you to fetch user details such as display name, email, phone number, and custom attributes associated with the user.

Input

PropertiesRequiredDescription
UIDrequired"User Identifier." It is a unique identifier assigned to each user in the Firebase authentication system.

Get user by email

retrieve user information by specifying the user's email address. It allows you to fetch user details similar to the UID-based method, but using the email as the identifier.

Input

PropertiesRequiredDescription
emailrequiredthe registered email associated with the user you want to retrieve

Get user by phone number

retrieve user information by specifying the user's phone number. It allows you to fetch user details similar to the UID-based method, but using the phone number as the identifier.

Input

PropertiesRequiredDescription
phone numberrequiredthe registered phone number associated with the user you want to retrieve

Create a user

create a new user in the Firebase authentication system. You can provide the user's email, password, display name, and other relevant information during the user creation process.

Input

PropertiesRequiredDescription
User objectrequiredan object that contains user's information

Update a user

update the attributes and properties of an existing user. You can modify the user's display name, email, phone number, password, and other custom attributes associated with the user.

Input

PropertiesRequiredDescription
UIDrequired"User Identifier." It is a unique identifier assigned to each user in the Firebase authentication system.
User objectrequiredan object that contains user's information

Delete a user

delete a user from the Firebase authentication system. This action permanently removes the user and their associated data from the system.

Input

PropertiesRequiredDescription
UIDrequired"User Identifier." It is a unique identifier assigned to each user in the Firebase authentication system.

List users

retrieve a list of all users registered in the Firebase authentication system. It provides paginated results, enabling you to iterate through the user list and retrieve specific user details.

Input

PropertiesRequiredDescription
Length of listoptionalnumber of users you want to retrieve in a single request
Next page tokenoptionalpagination when there are more users than can be returned in a single response

Query Firebase

perform queries on the database using various conditions and filters

Input

PropertiesRequiredDescription
Collectionrequiredcan use dropdown to select or use a raw id
whererequiredadd conditions to your query
limitoptionallimit the number of documents returned by the query.
Order byoptionalspecify the field by which you want to order the query results
Ordering directionoptionalthe direction of the ordering in the query results

Insert Document

create a new document in a collection or subcollection within Firestore. You provide the data to be stored in the document, and Firebase assigns a unique identifier (document ID) to it.

Input

PropertiesRequiredDescription
Collectionrequiredspecifies the name of the collection in which you want to insert the document. can use the dropdown to select or use a raw id
Document IDoptionalspecify a custom identifier for the document being inserted
valuerequiredthe actual data that you want to insert into the document

Update Document

update an existing document in Firestore. You specify the document ID and provide the updated data, which will overwrite the existing document's fields.

Input

PropertiesRequiredDescription
Collectionrequiredspecifies the name of the collection in which you want to update the document. can use the dropdown to select or use a raw id
Document IDoptionalspecify a custom identifier for the document being updated
valuerequiredthe actual data that you want to update into the document

Get Document by ID

retrieves a specific document from Firestore based on its unique document ID

Input

PropertiesRequiredDescription
Collectionrequiredspecifies the name of the collection in which you want to retrieve the document. can use the dropdown to select or use a raw id
Document IDoptionalspecify a custom identifier for the document being retrieved

Delete a Document

remove a document from Firestore based on its document ID

Input

PropertiesRequiredDescription
Collectionrequiredspecifies the name of the collection in which you want to retrieve the document. can use the dropdown to select or use a raw id
Document IDoptionalspecify a custom identifier for the document being retrieved

Get Collections

retrieve all the collections within a Firestore database. It returns a list of collection names available in the database.

Input

PropertiesRequiredDescription
Parent Document IDoptionalspecify a custom identifier for the document being retrieved

Query Collection Group

query documents across multiple collections with the same name. You can perform complex queries and retrieve matching documents from different collections that share the same name.

Input

PropertiesRequiredDescription
Collectionrequiredcan use dropdown to select or use a raw id
whererequiredadd conditions to your query
limitoptionallimit the number of documents returned by the query.
Order byoptionalspecify the field by which you want to order the query results
Ordering directionoptionalthe direction of the ordering in the query results

Query database

query the Realtime Database to retrieve data that meets specific criteria. You can define filters, sorting, and other conditions to retrieve a subset of data from a particular location in the database.

Input

PropertiesRequiredDescription
Database refrequireda reference to a specific location in the database.

Set data

write or replace data at a specific location in the Realtime Database

Input

PropertiesRequiredDescription
Database refrequireda reference to a specific location in the database.
Object to setrequiredobject contains the data that we want to write to the database, including the name, age, and email fields.

Update data

modify existing data at a specific location in the Realtime Database

Input

PropertiesRequiredDescription
UIDrequired"User Identifier." It is a unique identifier assigned to each user in the Firebase authentication system.
User objectrequiredobject contains the data that we want to update to the database, including the name, age, and email fields.

Append data to a list

use the "Push" method. It generates a unique key and appends the data as a new element in the list.

Input

PropertiesRequiredDescription
Database refrequireda reference to a specific location in the database.
Object to setrequiredobject contains the data that we want to update to the database, including the name, age, and email fields.