Archive | November, 2014

Google Calendar v3 API Gotchas

We use Google Calendar for quite a few of our clients. They get a nice interface for managing their events, and we can leverage the API to display the content in various places. Both by using our own developed tools and by using plugins like Google Calendar Events.

Just to cover all of the bases here, on November 17th, 2014, Google turned off parts of the v1 and v2 Calendar API and required access through v3. Many plugins were not updated in time and calendars went away only showing cryptic error messages. Even after the updates of some of the plugins and creation of special API keys, some sites were still unable to show their calendars.

This is the solution we had for our particular problem.

When you create a new “Server” Google API key for public access, you need to supply a list of IP address that are allowed to access the API with your key. Here’s the gotcha, if your hosting provider is IPv6 enabled, you must include your server’s IPv6 address as well as the IPv4.

That’s all well and good if you’re running your own dedicated server or VPS, but what if you’re on a shared host and they don’t list the IPv6 address of your server? We did a silly hack and popped the following code into a .php file and uploaded it to the sites that were still having problems:

[php gutter=”true” title=”ipv6.php” smarttabs=”true”]<?php echo file_get_contents(‘http://whatismyipv6.com/’); ?>[/php]

That will give you the IPv6 address of your web server. Just take that and paste it into your Google API console.

Delete the file when you’re done of course.