The questions below are specifically targeted for the Calendar Data API. There are, however, many questions that are applicable to all of the Data APIs. Visit the Google Data APIs FAQ if you do not find the question you are looking for below.
Because the Calendar data API is XML-based, you can use the API from nearly any programming language. Most languages have libraries for handling HTTP and XML, though this functionality isn't strictly necessary so long as you have some networking libraries and can manipulate streams and strings.
To simplify the use of our APIs, we provide several client libraries for some popular languages.
Download client libraries at the following URLs:Our partner, Zend, has a PHP client library as part of the Zend Framework: PHP
In general, functionality not available through the Google Calendar web interface is also not available through the API. However, you're welcome to post API feature requests to the Calendar data API discussion group.
Web Content events can be published either as an iCalendar file or via the Calendar data API.
Publishing via the Calendar data API:
A typical ATOM entry that represents a standard all-day event might look something like this:
<entry>
⋮
<title type="text">Independence Day</title>
<gd:when startTime="2006-07-04" endTime="2006-07-05" />
⋮
</entry>
This would create an event called "Independence Day" on July 4th. If you wanted to add web content to this event, you could change it as follows (added fields are in green boldface):
<entry>
⋮
<title type="text">No work today!</title>
<gd:when startTime="2006-07-04" endTime="2006-07-05" />
<atom:link rel="http://schemas.google.com/gCal/2005/webContent" title="Independence Day" href="http://www.google.com/calendar/images/google-holiday.gif" type="image/gif"> <gCal:webContent url="http://www.google.com/logos/july4th06.gif" width="276" height="120" /> </atom:link>
⋮
</entry>
These fields tell Google Calendar to display this event specially and where to find the additional web content associated with the event. The details for each of these fields is described below. You can set these fields using the Google Calendar data API.
text/html
or image/*
. This field is required if a CONTENT-URL
is specified. If text/html
is used, the content will be displayed in an IFRAME; if image/*
is used, the content will be displayed in an IMG element.type
attribute above. Publishing using an iCalendar file:
A typical iCalendar file that represents a standard all-day event might look something like this:
BEGIN:VEVENT
DTSTART;VALUE=DATE:20060704
DTEND;VALUE=DATE:20060705
SUMMARY:Independence Day
END:VEVENT
This would create an all-day event called "Independence Day" on July 4.
If you wanted to add web content to this event, you just need to add a few additional fields to the event description in iCalendar (the added fields are in green boldface):
BEGIN:VEVENT
DTSTART;VALUE=DATE:20060704
DTEND;VALUE=DATE:20060705
SUMMARY:Independence Day
X-GOOGLE-CALENDAR-CONTENT-TITLE:Independence Day
X-GOOGLE-CALENDAR-CONTENT-ICON:http://www.google.com/calendar/images/google-holiday.gif
X-GOOGLE-CALENDAR-CONTENT-URL:http://www.google.com/logos/july4th06.gif
X-GOOGLE-CALENDAR-CONTENT-TYPE:image/gif
X-GOOGLE-CALENDAR-CONTENT-WIDTH:276
X-GOOGLE-CALENDAR-CONTENT-HEIGHT:120
END:VEVENT
These fields tell Google Calendar to display this event specially and where to find the additional web content associated with the event. The details for each of these fields are described below:
X-GOOGLE-CALENDAR-CONTENT-TYPE
. text/html
or image/*
. This field is required if a CONTENT-URL
is specified. If text/html
is used, then the content will be displayed in an IFRAME; if image/*
is used, then the content will be displayed in an IMG element. Web Content events can be published either as an iCalendar file or via the Calendar data API.
Publishing via the Calendar data API:
A typical ATOM entry that represents a standard all-day event might look something like this:
<entry>
⋮
<title type="text">Independence Day</title>
<gd:when startTime="2006-07-04" endTime="2006-07-05" />
⋮
</entry>
This would create an event called "Independence Day" on July 4th. If you wanted to add web content to this event, you could change it as follows (added fields are in green boldface):
<entry>
⋮
<title type="text">No work today!</title>
<gd:when startTime="2006-07-04" endTime="2006-07-05" />
<atom:link rel="http://schemas.google.com/gCal/2005/webContent" title="Independence Day" href="http://www.google.com/calendar/images/google-holiday.gif" type="image/gif"> <gCal:webContent url="http://www.google.com/logos/july4th06.gif" width="276" height="120" /> </atom:link>
⋮
</entry>
These fields tell Google Calendar to display this event specially and where to find the additional web content associated with the event. The details for each of these fields is described below. You can set these fields using the Google Calendar data API.
text/html
or image/*
. This field is required if a CONTENT-URL
is specified. If text/html
is used, the content will be displayed in an IFRAME; if image/*
is used, the content will be displayed in an IMG element.type
attribute above. Publishing using an iCalendar file:
A typical iCalendar file that represents a standard all-day event might look something like this:
BEGIN:VEVENT
DTSTART;VALUE=DATE:20060704
DTEND;VALUE=DATE:20060705
SUMMARY:Independence Day
END:VEVENT
This would create an all-day event called "Independence Day" on July 4.
If you wanted to add web content to this event, you just need to add a few additional fields to the event description in iCalendar (the added fields are in green boldface):
BEGIN:VEVENT
DTSTART;VALUE=DATE:20060704
DTEND;VALUE=DATE:20060705
SUMMARY:Independence Day
X-GOOGLE-CALENDAR-CONTENT-TITLE:Independence Day
X-GOOGLE-CALENDAR-CONTENT-ICON:http://www.google.com/calendar/images/google-holiday.gif
X-GOOGLE-CALENDAR-CONTENT-URL:http://www.google.com/logos/july4th06.gif
X-GOOGLE-CALENDAR-CONTENT-TYPE:image/gif
X-GOOGLE-CALENDAR-CONTENT-WIDTH:276
X-GOOGLE-CALENDAR-CONTENT-HEIGHT:120
END:VEVENT
These fields tell Google Calendar to display this event specially and where to find the additional web content associated with the event. The details for each of these fields are described below:
X-GOOGLE-CALENDAR-CONTENT-TYPE
. text/html
or image/*
. This field is required if a CONTENT-URL
is specified. If text/html
is used, then the content will be displayed in an IFRAME; if image/*
is used, then the content will be displayed in an IMG element. POST
ing a new
entry
element to the comments feed. The comments feed location can be found in a
gd:comments
element inside the event entry. Please see the
documentation
on
gd:comments
for more information. A calendar event's comments feed location is typically the ID of the event with
/comments
appended.
To create a calendar - http://code.google.com/apis/calendar/developers_guide_protocol.html#CreatingCalendars
To delete a calendar - http://code.google.com/apis/calendar/developers_guide_protocol.html#DeletingCalendars
You can use the query parameter
max-results
to retrieve more than the default 25. If you wish to retrieve all of the events in a feed, set the
max-results
parameter to a really large number. You can also page through events by taking advantage of the
next
links, available as
child elements of a feed.
All-day events are created using a gd:when/@startTime
value representing the date on which the event will take place. As the gd:when/@endTime
value is exclusive, it should be set to the day after the event.
For instance, to create an all day event on the 5th of January, 2008, you would set the when
element to this:
<gd:when startTime="2008-01-05" endTime="2008-01-06"/>
You can choose to omit the endTime
attribute and the server will correctly insert the event. However, the endTime
will exist in the entry returned from the server.
For more information on the use of dates and times when working with single events, please see the Event "kind" documentation.
This can be done by including the
gd:attendeeStatus
element as a child of a
gd:who
element. Please see the documentation on
gd:who
Notifications are controlled by a boolean element called
gCal:sendEventNotifications
. To enable notifications, add this element as a child of the
atom:entry
element:
<gCal:sendEventNotifications xmlns:gCal="http://schemas.google.com/gCal/2005" value="true"/>
By default, entries are ordered based upon the last update time of the entry. You can choose to sort events by occurrence time by specifying
orderby=starttime
as a query parameter. Sorting can also be set as being in ascending or descending order using the query parameter
sortorder=(ascending|descending)
. The client libraries we provide contain functions to handle building the query strings for a feed.
An example URL for retrieving the next 10 events on the calendar of the authenticated user in ascending order is:
http://www.google.com/calendar/feeds/default/private/full?futureevents=true&orderby=starttime&sortorder=ascending&max-results=10
Exceptions to recurring events are created by
POST
ing a new
entry
containing a
gd:originalEvent
element referencing the
startTime
of the recurring event being modified. Updates to the properties of an event can be made, or the event can be canceled by changing the status of the event in the
POST
ed entry
.
futureevents=true
when requesting the feed. Client libraries also have some functions to handle building the query strings for a feed.
Yes, there is support through this element:
which can be added as a child to an entry. Corresponding
ExtendedProperty
classes also exist in the .NET and Java client libraries to assist you with these elements. Currently,
extendedProperty
elements cannot be deleted via the API or searched using the
q=
parameter.
The
name
attribute value can be up to 45 characters, and the maximum character length for
value
is 1024.
There is currently no way to delete an extended property.
There is an intermittent issue which is causing a 400 response when processing some
gd:recurrence
elements. The body of the response will be "Failed to process recurrence rule". Please try the request again.
Custom time zone definitions in recurring events do not currently work. Please use a standard Java time zone ID.
One-time-use tokens are not currently supported with Calendar. Please exchange it for a session token instead.
A 404 error is currently returned if you are missing the proper xmlns namespace declarations on the entry. Please make sure you are specifying this correctly in your update.
A 400 response with a message "Single event must not have a recurrence rule" is currently returned when trying to change a non-recurring event into one with a recurrence rule.
This error is caused by a communication failure on the server side. This error is returned in a HTTP message with a 500 status code, indicating that the problem was on the server rather than in the data you sent. If you get this error you should resend your request.
There is currently no way to delete an extended property.