Kloudless Blog

Kloudless Unified APIs enable you to code once and integrate many

This article is a part of our “Getting Started” series, with featured articles on getting started with API integrations to Dropbox, Gmail, Salesforce, MS Teams, and Microsoft Exchange.


Having worked with the Google Calendar API quite a bit, we wanted to write up a brief walkthrough to help others learn how to use the Google Calendar API. Getting started with the Google Calendar API is relatively easy and requires you to go through a simple setup process on the Google developer portal before you can allow users or organizations to access their calendars and scheduling data from within your application. 

Setting Up Your Application in the Google Developer Portal

To get started, sign up for a developer account or log in at https://developers.google.com/. If you have not yet created a project, visit the Google Developers Console to create a new project. Give the application any name you want and click on “Create.”

Now that you have created a project, there are a few key steps we need to take before you can start making API requests to the Google Calendar API.

Enabling the Google Calendar API

Before we can do anything with Google Calendar, we have to enable the API. Click “ENABLE APIS AND SERVICES” and search for the Google Calendar API, and then click ENABLE under Google Calendar. This step is absolutely necessary is allowing your new project to have access to the Google Calendar API.

Configure an OAuth Access Token

Now we’ll configure your application’s unique OAuth token. Click on Credentials if you haven’t been redirected and click ‘CREATE CREDENTIALS’ => ‘OAuth client ID’. 

Once you have your OAuth Client ID, we can get started making calls to the Google Calendar API. 

Scopes

You will probably want to verify your application with Google. Please fill out the verification form with this process. The verification form requires information on the scopes used, which are:

  • https://www.googleapis.com/auth/userinfo.email
  • https://www.googleapis.com/auth/userinfo.profile
  • https://www.googleapis.com/auth/admin.directory.user.readonly
  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/contacts.readonly

The scopes above are used to identify the user, monitor changes occurring in their account, and access data in their account. More specifically:

  • The User info scopes are used to retrieve user profile information to indicate which user connected their account.
  • The Admin Directory scope is used to identify other users to invite to meetings.
  • The calendar scope enables calendars and calendar events to be created, modified, and retrieved by our application. Include a reason here
  • The People API lets users look up their contacts to invite to meetings created via the Calendar API.

For a comprehensive list of Google OAuth scopes, please refer to the direct documentation.

Making your first Google Calendar API request

Once your application has been configured in the Google developer portal, you are free to make calls to any endpoints available to you. As an example, we’ll send a GET request to the /calendars/:id/events endpoint, which will retrieve a list of events on a calendar by searching for its unique <calendarId>.

The base URL of the Google Calendar API is: 

We’ll prefix that base URL before any of the endpoints we wish to retrieve data from. In this case, since we are calling to the /calendars/:id/events endpoint, our GET request will be formatted like so, with the <calendarId> being the unique identifier for the calendar we wish to retrieve:

If successful, you will receive a response body with the following structure and property types:

For a comprehensive list of the endpoints available within the Google Calendar API, please refer to the documentation here.

Kloudless is the best way to integrate Google Calendar

Integrating with Google Calendar can take as much as 6 months of development time, and that’s not taking into account the ongoing maintenance and support to keep that connection sound in the future. 

The Kloudless Unified Cloud Calendar API was built to connect your application with Google Calendar, Microsoft Outlook, Microsoft Exchange, Office 365, Apple iCloud, and CalDAV. With Kloudless, you can schedule events across every major cloud calendar provider. Your app can take advantage of full CRUD and real-time bi-directional calendar sync between your app and any cloud calendar service your users need access to. Kloudless offers extensive activity monitoring and webhooks to all of our connectors, as well as support for all major event bus services.

Kloudless also takes away the headache of maintenance and API updates, so your development team can focus on what’s important: Your app’s core functionality.

Using Kloudless with Google Calendar

You can sign up today for a free developer account with Kloudless and get started with integrating to Google Calendar or any of the other connectors provided in the Unified Calendar API. 

Once signed in, you will find the Callback URL or redirect URI under THIRD-PARTY SERVICES => Configuration. Please click the SaaS product Google Calendar and select “Use Your Google Calendar Keys.”

After filling in the Client ID and Client Secret, you will also need to set a specific Callback URL or Redirect URI from the Google Developer portal. Click Save and you’re all set.

To learn more about the Kloudless Unified Calendar API, please visit our product page or direct any inquiries to hello@kloudless.com.

Categories:

Share this article:

Let’s get started. Start building for free today.