Dear amazing people,
I have been using Appgyver for exactly a month today, and while it has been hard for me as a non-tech newbie, I learnt quite a ton. I have collated micro documentation of the major tips I learnt on the way and thought it might be helpful for other Firebase backend users.
Tips currently cut across Authentication, updating documents fields and many more. I highly encourage collaboration to add to this list of tips, and I hope you find these as useful as I did.
Ooh, and if you find another lost copy of this on the forum kindly alert me, I had tried to upload this earlier and had bad internet connection so I don’t know here that went.
Cheers.
REST API
How to Update a document using the PATCH method for REST API.
Use the following URL.
How to Update a single field using the PATCH method for REST API. Reference Resources
Use the following URL.
How to get a document using GET method for REST API
Use the following URL.
How to get a field from a document using Get method for REST API
Use the following URL.
How to get a collection of documents using REST API
Use the following URL.
How to delete a one or more field(s) form a document using PATCH method for REST
Use the following URL. However, in the body of the HTTP request, do not add any update for the field. This does the function of deleting only that field.
- https://firestore.googleapis.com/v1beta1/projects/{projectId}/databases/(default)/documents/{document_path}?updateMask.fieldPaths={fieldName}&updateMask.fieldPaths={fieldName2}
How to create one or more new field(s) into a document using PATCH method for REST
Use the following URL. IN the body of the HTTP request, write the field name as key and Value only.
- https://firestore.googleapis.com/v1beta1/projects/{projectId}/databases/(default)/documents/{document_path}?updateMask.fieldPaths={fieldName}&updateMask.fieldPaths={fieldName2}
How to create a document using POST method for REST
Use the following URL. In the body of the HTTP request, write the intended field of the document.
How to create a document, with an assigned documentID using POST method for REST
Use the following URL, ensure to add ?documentid={DocumentID}. In the body of the HTTP request, write the intended field of the document.
- https://firestore.googleapis.com/v1beta1/projects/{projectID}/databases/(default)/documents/{CollectionID}?documentid={DocumentID}
How to create Subcollection with a Document inside of it using POST method for REST
Use the following URL. In the body of the HTTP request, write the intended field of the document.
How to store a file in Firebase storage and connect it to you database Using POST method on REST API
Use the following URL. In the body of the message, upload a binary file into the image.
How to retrieve a file in Firebase storage and connect it to you database Using GET method on REST API
If there is no authentication rule on the storage, use the following URL.
If there is an authentication rule on the storage, use the following URL.
How to retrieve a file in Firebase storage and connect it to you database Using GET method on REST API
If there is no authentication rule on the storage, use the following URL.
If there is an authentication rule on the storage, use the following URL.
- https://firebasestorage.googleapis.com/v0/b/{Product Path}/o/{File Name}?alt=media
Sample Field Format:
{
“fields”: {
}
}
How to connect Collection from firestore REST API to Appgyver
- Copy the path: https://firestore.googleapis.com/v1beta1/projects/{projectID}/databases/(default)/documents/{CollectionID} from the firestore
- Open Appgyver composer platform and open the Data configurator. Add Data Resources and choose REST API intergration.
- Paste the https://firestore.googleapis.com/v1beta1/ as the Resources ID for the Base
- Go to the GET COLLECTION (GET) and past the projects/{projectID}/databases/(default)/documents/{CollectionID} as the Relative path.
- Run Test and Generate Schema.
How to Connect Data from FireStore to Appgyver
- Create Data Variable from the generated collection
How to create a record on Appgyver from Firestore
- Fill in the details of the Create Record(POST) session of the resource
How to signup and verify a new user using email and password with POST method on REST API
Step 1: Sign-up
Use the following URL: https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]
And create in the request body, {“email”:"[user@example.com]",“password”:"[PASSWORD]",“returnSecureToken”:true}
You will get a response body like this:
{
“idToken”: “[ID_TOKEN]”,
“email”: “[user@example.com]”,
“refreshToken”: “[REFRESH_TOKEN]”,
“expiresIn”: “3600”,
“localId”: “tRcfmLH7…”
}
Step 2: Send verification code:
Use the following URL: [https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=API_KEY]
Create a request payload:
{"requestType":"VERIFY_EMAIL","idToken":"[FIREBASE_ID_TOKEN]"}
How to Create a Search box that autosuggests: Link