Reputation: 325
I have an app that uses firebase real time database and a link to the database: https://myapp.firebaseio.com/ I want to write to the database something like this using the URL: https://myapp.firebaseio.com/some_string so that in my app, I could read some_string. Can I achieve this? I don't want to use curl and do this from the command line.
BTW, I opened the DB to be public so no need for authentication.
Upvotes: 1
Views: 5016
Reputation: 7720
Based on your comments, you want to write to the database using REST API (by URL) using a web browser.
From this Firebase REST API usage guide, you need to have access to PUT HTTP request to be able to write data to the database using REST API. But the majority of browsers only support GET and POST requests, so you can't do that directly from the browser's address bar.
If you are using Chrome browser, you can use Postman extension to call that request. Here is a usage example:
Hope this helps :)
Upvotes: 1
Reputation: 325
I succeeded to implement it using firebase functions. see link: https://firebase.google.com/docs/functions/get-started#add_the_addmessage_function
Upvotes: 0
Reputation: 138824
No, you cannot write to a Firebase database something using only the URL. What you need to remember is that every node from your database is a JSON file coresponding to that URL and also a DatabaseReference
.
To write data using Android, you can simply use setValue()
method directly on the refrence like this:
yourRef.child("name").setValue("John");
Hope it helps.
Upvotes: 2