1

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.

3
  • do you mean that you want to write "some_string" to the realtime database by calling a GET request and not POST request? and from what device will you write that string? an android/web/or? Commented Jul 17, 2017 at 14:31
  • You can interact with the Firebase Database on a URL level by using its REST API. But as Alex answered, you're much better off using an SDK that is targeted to your platform. Commented Jul 17, 2017 at 14:44
  • @Wilik I want to write to the db using browser from computer Commented Jul 17, 2017 at 14:50

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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: enter image description here

Hope this helps :)

Comments

0

I succeeded to implement it using firebase functions. see link: https://firebase.google.com/docs/functions/get-started#add_the_addmessage_function

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.