FileMaker and Firebase Integration Part 1

Good Morning Everyone!

Today we will be starting a look at integrating another wonderful web API called Firebase!  Firebase Website

Screen Shot 2015-11-22 at 10.47.54 PM.png

Firebase in a nutshell is a back end JSON data server that can easily be synced between all different devices and environments (iOS, Android, Javascript, Browser, etc). There is plenty of security options, and plenty of documentation on it all along with great example programs using Firebase. So think of it like if you had some data you entered in your FileMaker database on your Mac desktop, if you pushed that data to Firebase, an app you have made or integrate with can easily get that same information in realtime without having to do any kind of server set up or PHP scripts.

Screen Shot 2015-11-22 at 1.46.12 PM.png

Signing up with Firebase is completely free and the limitations on your data is actually quite nice of them to allow. So go sign up and make your own Firebase app on the site and take note of your firebase URL it gives you.

Screen Shot 2015-11-22 at 1.46.37 PM.png

Firebase uses a Restful API which means we can communicate to it’s data through URL calls. Unfortunately, with how Insert From URL works we can only REQUEST data from Firebase with that script step since POSTing data requires a JSON body sent with the URL to Firebase. But do not fear, BaseElements is here to save us from frustration at Insert From URL. The wonderful FREE BaseElements plugin allows us to do the specific data sending to Firebase to allow us to also Insert, Update, Delete, etc to the Firebase data!

Link to BaseElements Plugin (Thank you Goya, you rock!)

Before you get started, make sure you visit the Firebase site and sign up for a free account so you can set up your own app and test with your own info as you go along. Also make sure you download the example FileMaker file HERE.

 

First:  You will want to open up the example FileMaker file I linked above. It should contain the BaseElements plugin in the file if you haven’t installed it yet. The first layout should just be a main layout that you can navigate to the different examples and also contains some links to certain web pages that can be helpful to following along.

 

Screen Shot 2015-11-22 at 11.10.17 PM.png

 

Second: We have the GET page. It should contain buttons that will request data from one of my Firebase apps called Rumchata. It should contain a few recipes that contain Rumchata. I also included one that just uses Insert From URL and the other will use the BaseElements plugin to request the data. At this point they are almost identical and the plugin really isn’t required. There is also a Custom set of buttons that will allow you to enter your own Firebase app URL to attempt requesting data from your own Firebase.

 

Screen Shot 2015-11-22 at 11.04.26 PM.png

 

Third: We have the PUT page. It contains similar options like the GET page but all of these will require using the BaseElements plugin. We first have the buttons that allow you to enter some recipe data and then we send the data to Firebase with a PUT.

Screen Shot 2015-11-22 at 11.05.23 PM.png

Then we also have the custom option where you can enter your Firebase URL and a key/value pair that you will PUT to your own Firebase app.

Screen Shot 2015-11-22 at 11.05.45 PM.png

These both use new script steps that are setting a JSON variable. So to do a PUT request (and POST), we use the base URL to the node you are adding data and the JSON variable you set with the key/value pair you set up.

Screen Shot 2015-11-22 at 11.06.52 PM.png

 

Fourth: We have the POST page. It contains options much like the PUT page, actually the PUT and POST options are very similar. The main difference is when you use a POST to Firebase, it generates a unique key as the parent of the data you send. So say you use the URL: https://rumchata.firebaseio.com/users_post.json  with a key: “username”, and value of “Nick”. In Firebase, the path to that user you added would be something like: https://rumchata.firebaseio.com/users_post/-INOQPH-aV_psbk3ZXEX/username

Screen Shot 2015-11-22 at 11.07.52 PM.png

This is useful for easily adding unique values into Firebase which then you can recall later.

So, look over the scripts, mess with any of it and try and get a feel for sending and receiving data through Firebase! Look through the API documentation a little and find some other functions you can incorporate with Filemaker.

Part 2 of the series will be parsing the data in Filemaker, updating information in Firebase and the start of using a WebViewer so we can create our own Chat client in Filemaker!

Please leave any comments, questions or suggestions on this or anything else you would like to go over! Follow me on twitter (@pudgyplatypus) to get any updates on Filemaker stuff or any of the silly games I make. Also check out MC Services’ website if you are in the market for Filemaker development or Mac consulting!

 

Nick

 

Advertisements

5 thoughts on “FileMaker and Firebase Integration Part 1

  1. Many thanks for this tutorial Nick, I’m just getting into Firebase and the possibility of integrating an app with our FM database is a tantalizing prospect! I’ve yet to go through the full tutorial, but do you anticipate any potential issues due to me using Firebase v3 (firebase.google.com)? I ran into some issues with a cordova/ionic app a few days ago where it wouldn’t work against the new Firebase URLs (it works with the same project in Firebaseio.com), but that may have been a one-off issue to do with the auth rules.

    Any idea of when part 2 might be coming along…?

    Cheers,
    Paul

    • Hey Paul!
      Glad you liked the post and hope it helped at least a little. It’s interesting you bring up v3, I totally forgot that the new version was through Google the other day and was quite confused on navigating to a totally different website lol. I had taken a look at the API references and it is actually more complicated than I was hoping for Firebase, but I think it looks manageable. Let me see if I can through together something and maybe I will just make that the part 2!

      Oh and also a reminder that I end up posting a lot more stuff through my Twitter (@pudgyplatypus) so make sure to check there and throw me some suggestions or cool things you find!

      Nick

  2. Thank you so much for this! I am still learning how to use this PlugIn but I will be super happy if I can get it to work for our simple music database. Do you have any FMP consultants you would recommend to help me create my solution and implement it?

    • Hey Stan I’m glad you liked the post! We sure do here at MC Services, you can get our main number or emails from our website (www.mcservices.com) and mention you came from here and were looking for some FM help to get something set up! Thanks and let me know if you have any other questions!

      Nick

  3. Any chance of updating this with the new FireBase? The post and put no longer seem to work? When do you expect V2 to come out? 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s