I am confused as to how to connect to my Firebase DB using, say Postman to send the REST requests.
In the screenshot below, you can see my DB structure and GET request.
Specifically, the GET request in Postman looks like this,
https://fir-crud-api-b1cec.firebaseio.com/products/test.json?auth=xxxx
while the DB is structured as such
products > test.json
Would appreciate any advice to point me in the right direction. Thanks!
Your URL suggests that you want to use the Realtime Datbase REST API, but your screenshot suggests that your data is in Firestore. These are different databases with different APIs.
If you want to work with data in Firestore, you should use the Firestore REST API instead.
The screenshot on the left shows the Cloud Firestore database, while in PostMan you are trying to access the Realtime Database. While both databases are part of Firebase, they're completely separate, and have completely separate REST APIs.
If you want to access Cloud Firestore from PostMan, have a look at its REST API. Fair warning that this API is significantly more complex than the one for the Realtime Database.
If you want to continue using the Realtime Database REST API, make sure to create your data structure in the Realtime Database in the Firebase console.
Related
i want push some data to my real time database firebase, I have my database structure like this
I've successfully done inserting data using query string with PHP using $_GET method in free web hosting, but it has limited hit request and i don't want to pay for web hosting, since I know firebase is free, I would like to use it.
ok so, i want to push the data using url query string. when i hit the url like
https://gps-iot-8a30e.firebaseio.com/koordinat?created_at=2020-01-01&latitude=6.231435&longitude=6.231454
the data should be added to 'koordinat' reference and automatically generate the key id. is there any way to insert data like that? What should i do? should I make some sort of REST API server? any help would be appreciated. thanks.
There is no way to add data to the Firebase Realtime Database REST API with a GET request. The new data will always have to be in the body of the request, which GET requests don't support.
See the Firebase documentation on ways to save data with the REST API.
What you can do is create a custom endpoint on for example Cloud Functions that takes the request you send from your PHP, and then converts that into a format that the Realtime Database supports. If you're doing this on Cloud Functions, you might as well use the Node.js SDK that Firebase provides, instead of dealing with the REST API there.
I have a chip that has internet connectivity that I am programming using C language. I am able to make http requests using this language, so I thought that the Firestore REST API would save me. Unfortunately, I can't figure out a way to get live changes from the REST API. Any ideas?
firebaser here
There is currently no public API to get realtime updates from Firestore over its REST API. See the reference docs for a list of available operations.
Also see:
Firestore REST API database listening, which mentions that you can get this behavior through the RPC API.
I'm teaching myself to use Flutter and I'm making an app that queries The Movie Database API. Currently, I'm having the client query the API on launch but I'm thinking this is not the most efficient way of doing it, and I would rather have the client query a backend service like Firebase to get the same data.
I would appreciate some guidance into where to start in order to setup a periodical process to query the API and use the results as entries into a Firestore DB. I've looked online but I might be using suboptimal keywords since I haven't found a good tutorial or example for this.
Thanks.
You can use Firebase Cloud Functions to build code that runs on Firebase servers to fill your Firebase database, but you can only make HTTP requests to non-Google addresses if you use a paid plan.
https://firebase.googleblog.com/2017/03/how-to-schedule-cron-jobs-with-cloud.html explains how to invoke periodic tasks with Cloud Functions. It utilizes Google AppEngine for that because Cloud Functions doesn't provide that out of the box.
Currently I'm working on a mobile app using Ionic and Angular2 with Realtime database service from firebase. I want to make a chatbot using Dialogflow to analyze the user request (i.e. I need a wheelchair) and then analyze the firebase db for any similar items stored, and if it exists, I need to show the item's name and the uid of the user who has added it into the database.
Have seen some tutorials on Dialogflow with Cloud Firestore but I'm not sure whether this works with the Realtime DB and how it would work.
Thanks in advance. 😊
To do this, you'll need to use a fulfillment webhook that will be sent the information about what the user has said, does the database search, and sends the reply using Dialogflow's response JSON format.
If I create a web app with the serverless client-firebase model, it seems almost 100% my data structure, comprises of nodes, subnodes, duplicate nodes and key:values, is exposed by those DB ref URLs, CRUD and atomic update functions from client js code .
I am not saying that I am not gonna put DB rules, but to only question that exposing so much info which client does not need at all, is it beneficial to hackers only?
I am thinking of create a REST API in the middle and hide firebase queries, but this somehow against the serverless idea. is Cloud Functions for Firebase a cue here?
P.S. I have read related questions below, but they are not the same.
How to restrict Firebase data modification?
Is it safe to expose Firebase apiKey to the public?