Get, Post, Put and Delete from my API Firebase

Not applicable

Hello

I developed a mobile application with Firebase in back end and ionic in front end. Now I want to expose the resources of my api firebase on Apigee Edge API Management. The problem is that I can not get my resources Get, Post, Put and Delete from my API Firebase to expose on Apigee Edge.

Could you please help how I can create my proxies for the objects that i have in Firebase knowing that these objects are in json format.

Please assist on this.

Thanks,

Michael

1 7 2,153
7 REPLIES 7

Not applicable

Hi @TONGLE. Definitely this is a great use case of Apigee. If you're familiar with Node.js and Express you can proxy API calls from Apigee to Firebase by leveraging Firebase Admin NPM module.

For data retrieval for example you'd need something like this with a little bit of Express:

// Import Admin SDK
var admin = require("firebase-admin");
// Get a database reference to our posts
var db = admin.database();
var ref = db.ref("server/saving-data/fireblog/posts");
// Attach an asynchronous callback to read the data at our posts reference
ref.on("value", function(snapshot) {
  console.log(snapshot.val());
}, function (errorObject) {
  console.log("The read failed: " + errorObject.code);
}); 

If what you're looking for is along these lines. Let me know, I can continue elaborating on your example and create some sample API Proxies for it.

Hope it helps!

Hi Diego, 

Thank you for your answer. In fact I developed a mobile application with Ionic and Firebase that works like this (Firebase <----------> Client). 

Now I would connect Firebase to Apigee so that my application now communicates with Apigee by creating a proxy (Firebase <-------> Apigee <-------> Client).

How can I connect Firebase to Apigee? Then connected Apigee to my mobile app. 

Knowing that my mobile application is developed with ionic that is passed on Angular Js.

I have not used Node.js in my code. If this is the solution to solve my problem how I can currently integrated.

Thank you in advance for your return, to further enlighten me on this subject

Michael, 


If you're familiar with Express, this should be pretty straightforward. If you haven't used it in the past, I can provide direction on this. Let me know.

I have not yet used Express. I would appreciate your help in providing me with directions.

Thank you very much.

Not applicable

No problem. The following sample Apigee Firebase Node.js Express API Proxy bundle, which has GET (retrieve all entries from /products resource) and POST (/products for create and update in Firebase). This has also been tested locally and on Edge. For deployment on Edge, you can either use Apigeetool or the zip bundle included in this answer or git repo.

For other operations, refer to Firebase Node.js SDK documentation, it's pretty good.

Hope it help! Good luck!

apigee-firebase-nodejs-express-api.zip

Hello Diego,

First of all i would like to thank you for your answer which was really useful for me.

I watched Firebase Node.js SDK documentation for other operations but it is not clear for me, any explinations please to configure all in file index.js?

Actually, i couldn’t do « get /products/id ».

Can we do the « get, post, put and delete » with postman ?

Regards

Michael

Not applicable

hi @Diego Zuluaga, can u please help me with delete node from firebase database with node js sample

,

Hi can u add delete node from firebase database. @Diego Zuluaga