Save more now with Calendar API!

April 24, 2014

Link copied to clipboard
By Lucia Fedorova, Google Calendar API Team

Today we are enabling several ways to save your Calendar API quota, network bandwidth, and, most importantly, batteries of your users' phones.

Previously, when you wanted to know whether a user changed the color of his calendar, you would need to poll the server frequently, downloading the entire calendar list each time. This is no longer necessary as we are announcing three major improvements to the Events, Calendar list, ACL and Settings collections:
  • Incremental synchronization using sync tokens. Incremental synchronization allows you to retrieve only resources that have been modified since the last time you synchronized and thus avoid retrieving all the resources in the collection all the time. At the beginning of the synchronization process, you retrieve all the resources you are interested in and store a sync token. On follow up requests, you can use the sync token to restrict the results to only the resources that have changed since the token was issued. This functionality is now available for all four main calendar collections. Learn more

  • Push notifications. Push is a great way to avoid repeated polling. Last year we announced support for push notifications for event changes. Now we are extending push notifications to Calendar list, ACL and Settings collections. You start by subscribing to the collections you are interested in. The server will figure out when something you are interested in has changed and send you a notification. Learn more

  • Pagination. Pagination gives you control over the number of results that you will retrieve from the server so you can read through many results at your own pace. Events and Calendar lists have already supported pagination for a while; today we are bringing you pagination for ACL and Settings collections. Learn more

Let's demonstrate what synchronization could look like:
“OK server, I would like all the settings of this user.”
“Here you go, dear client, all the entries and a small bonus called a sync token.”
“Thanks, server! Please let me know if something changes in the settings of this user.”

Later that day

“Hey client, the settings have changed. ”
“Cool, here is my sync token, what are the changes?”
“There have been many. I’m now sending you the first hundred of them and a page token.”
“Got it! Here is the sync token and the page token, what else has changed?”
“Here are the remaining twenty new settings. And of course, a new sync token.”
“You are the best, server! Thank you!”

Lucia Fedorova is a Tech Lead of the Google Calendar API team. The team focuses on providing a great experience to Google Calendar developers and enabling new and exciting integrations.

Posted by Louis Gray, Googler