Filemaker Google Calendar API

by Mike Phalen

FileMaker_GoogleCalendarAPI.fmp12 Hi Everyone, I’ve been working on accessing the Google Calendar API 3 thru Filemaker and put together this quick summary of what I’ve learned. It is all Filemaker programming, no other language skills required. This file contains scripts to invoke four Google Calendar functions: create calendar, create event, edit event and delete event. The scripts are not dependent on layouts, fields or custom functions and can be copied and pasted into your fm file. All parameters are entered in the script parameter when calling the API scripts. A parameter template is at the beginning of each API script. There are many more calendar functions that can easily be implemented using the same technique used here.

Most of the new Google API’s can be accessed directly using REST. I believe this allows Filemaker to directly access the Google mail, maps, translate, search and gDrive APIs! Although I haven’t tried them yet.

I have other calendar scripts that are not included in  this file for syncing Google Calendar with Filemaker and other misc functions. If you need them let me know.

31 responses to “Filemaker Google Calendar API”

  1. Valentin says:

    Mike,

    this is an awesome module! I love using REST API because it really extends my solutions. So far I have not been able to get the OAuth authentication going – which is exactly what you are doing here and it not only opens the door to a whole lot of Google Apis but also other ones. Thank you very much for sharing this here!

    • Mike Phalen says:

      Thanks Valentin. I agree REST is pretty easy and puts a lot of external functions at our fingertips. I’ve recently created a script to empty the trash in my gDrive. Right now I’m playing with getting my google mail. Below is an example using the Google Mail API sand box.

      – Go to this link https://developers.google.com/gmail/api/v1/reference/users/threads/list#try-it .
      – Make sure you have a gMail account open in another browser tab.
      – Click Authorize, on the right.
      – Enter Me for a UserID. I got an error, “message”: “Delegation denied”, when I entered my Google Dev UserID. Not sure what is up with that. Thanks where I left off.
      – Click Execute, it will return the first page of your email ID’s and a nextpagetoken.

      I’m glad it’s working for you. Mike

  2. Andreas says:

    Hi Mike, this is really great. I had been trying to do something like this for a while and your solution is much nicer than anything I had come up with to date. I am interested in trying to allow for syncing between google calendar and a fm calendar. Through your scripts I can ensure that any event added to the FM database is automatically inserted or updated on the google calendar, but if someone modifies the google calendar I’ll need a way of checking periodically for those changes.

    When you’ve done these functions were you using an insertFromUrl and including the nextSyncToken to get a list of events, then somehow parse those results into a variable (perhaps the JSON-FM module?) and loop through them comparing their date modified with those present in the FM database?

    Not entirely sure how I go about all of that just yet but making sure I’m not barking up the wrong tree entirely.

  3. Jim Hickam says:

    In looking over the file download I notice that the upper right corner of the screen suggests a plug in and the fact that a function is missing in numerous script steps also suggests this… The above made me think that you were doing this all sans a plugin.

  4. Vince says:

    Mike,

    This is great and very timely for me as I have a new client that wants to be able to work with his Google calendar. If you have a script that would allow Filemaker bring events from the Google calendar into FM that would be fantastic.

    Thanks for your work.

  5. John says:

    Excellent job Mike! Very Complete demo. Works great and makes it easy to use on other projects.

    I did get tripped up in a couple of spots:
    -I’ve never installed a FMP plugin before, so finding and installing the “Base Elements Plugin” was my first hurdle. If the instructions covered this, I missed it. I had to create a portal in one of the tables to put it in.
    -The second hurdle was after hitting the “Send Oath Authorization” button, I kept getting an “Unable to connect” error in the web browser. It took me a while to figure out it was ok to simply ignore this error, and focus on the next step in your FMP demo.

    In spite of my difficulties, I’ll still give you 10 stars for the usefulness of the solution!
    Very masterful!

    Thanks again,
    John

    • Mike Phalen says:

      Hi John,

      Thanks, I’m glad it is helpful to you. I will add some more information about plugin installation. The plugin can be installed by dropping it into your extensions folder in your Filemaker App folder. A portal is not required to instal the plugin. I don’t remember seeing the unable to connect error that you mentioned.

      Let me know if you have any questions, Mike

      • V says:

        Two problems I’m currently having with setup:
        1. I tried installing the plugin by dropping it into extensions folder but it still shows up as missing on the fm file.

        2. Also, on step2: create a google calendar, I am getting Error:Getting access token. Google response: ? .
        I tried regenerating the access token to see if that was the issue, but same error.

        • V says:

          Edit: Installed plug in successfully but for 2. error now says Google response: { .

          • Lazlo says:

            Were you able to resolve this issue?

            I am getting the same error on the last step of the setup.

            Error getting Access token
            Google Response:

            {

    • Mike Phalen says:

      Hi Martin,

      From the error message it sounds like it could be the redirect in the developer console. It is Google Oauth item 5.1 in the module. Can you send me a screen shot of your developer console settings? Thanks, Mike

  6. Jeremy says:

    I am running into an issue with the Oath Authorization. I have pasted my Client ID and Secret into your fmp solution. I send the authorization request. I click on Accept to “Manage your calendars”, and immediately I get an ERR Connection refused, webpage will not load. My guess is it has something to do with the redirect, but http://localhost is exactly how you described it. Any help would be greatly appreciated. As an aside, I did notice the URL on the error page had an = sign, so I copied that into the “Authorization Number field” but i just get a dialogue box “Protocol not supported”. Thanks in advance.

  7. Pitan says:

    Hello,
    this solution is very good thank you.

    How could i set this up so it works the scripts on the server?
    I have filemaker go solutions so i need this option to effectively work for me.

    Thanks

  8. Damien Kelly says:

    Hi Mike,

    This is fantastic! Can I have the scripts for syncing pretty please?

    Thanks,
    Damien

  9. Mark says:

    Hi Mike, I just wanted to appreciate your pathfinding efforts in pulling this all together, and making a templated solution available for everyone. I followed your instructions, everything worked flawlessly and it was easily integrated in my FM13 setup. Excellent job, very clear demo and thanks again

  10. Lazlo says:

    Is it possible to send event invitations via the Google calendar API?

    If so, does anyone have an example of how this is done?

  11. Lazlo says:

    Is it possible to use an existing calendar or do I need to create a new one?

  12. Jim Hickam says:

    Mike
    I have personalized your scripting for a solution. I have it working but about every 5 or 6 events do not show up on the calendar. I don’t even know where to begin to troubleshoot this as it appears to be either a google issue or something to do with the token. Do you have any ideas?
    thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *