1

After some research for a tutorial about implementing REST APIs with Firebase, everything I could find was the code snippets with the curl (or other help libs) method calls. But I could not find anything about the basics like where do I have to call those methods, how do I connect the different things etc..

What do I need this for:

I'm programming an WebApp with the Ionic Framework, HTML5 and JavaScript and I needed to store some data in a backend, so I choosed Firebase since the reviews were pretty good.

What I want to do:

I need to query my (already existing) data in Firebase with a variable I have calculated in a JS file and return the result to the same JS file for further calculations. I would preferably use the python lib https://github.com/thisbejim/Pyrebase recommended on the Firebase REST API tutorial page https://firebase.google.com/docs/database/rest/start since I've got some pre-knowledge there.

My question:

Where do I implement that REST API with a python script ? Do I have to create a .py file, include it into the index.html, write the methods in there and somehow call it in my JS file ? I literally have no idea about that.

Any kind of help is highly appreciated !

Best regards, jule

1 Answer 1

2

If all you need to do is have your JavaScript read and write data from the Firebase database then you don't need to use the REST API or implement anything in Python.

Instead you should be able to use the Firebase JavaScript interface to talk directly to the database from your JavaScript code. You can get started by following the instructions at

Firebase: Installation & Setup in JavaScript

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

2 Comments

What was in my head is to query the data in Firebase with the API but it seems I can also do it with a forEach() loop over the data and without the API. Thanks for the hint tough.. could've guessed that solution my myself :) Accepted answer anyway
@eamonn-obrien-strain What's the advantage of REST API over firebase JS interface? I mean what can only be possible with REST API which isn't possible with JS interface. Why I am asking is I can do all CRUD operations with JS interface so that got me thinking which things are only possible with REST which aren't possible with JS interface. Thanks

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.