A Google Data API is an API based upon the Google Data protocol. The Google Data protocol is based on the Atom 1.0 and RSS 2.0 syndication formats, plus the Atom Publishing Protocol (APP).
The Google Data protocol extends those standards in various ways, using the extension mechanisms built into the standards. Feeds conform to either the Atom or RSS syndication formats. The publishing model conforms to the Atom Publishing Protocol.
The protocol also provides a general model for feeds, queries, and results. You can use it to send queries and updates to any Data API.
JSON refers to JavaScript Object Notation.
JSON is a lightweight data interchange format whose simplicity has resulted in widespread use among web developers. It is easy to read and write; you can parse it using any programming language, and its structures map directly to data structures used in most programming languages.
Read more about Using JSON with the Google Data APIs.
alt
query parameter.
alt=rss
alt=json
or alt=json-in-script
Read more about Requesting and using JSON feeds.
alt=atom-in-script
alt=json-in-script
, but results are returned as an
Atom XML string rather than JSON. alt=rss-in-script
alt=atom-in-script
, but results are returned as an
RSS XML string rather than Atom. Read more about the alternate formats in the Google Data Reference Guide.
No, but you can use Gmail's
Atom feed with AuthSub or OAuth
1 to request read-only access to a user's unread messages. The scope
should be set to https://mail.google.com/mail/feed/atom/
. An
example query would be:
GET https://mail.google.com/mail/feed/atom/
If you're interested in managing your mail, Gmail also has IMAP/POP support.
In the Google Data APIs documentation, "OAuth" refers to OAuth 1; for OAuth 2.0 details, see the documentation for your individual API.
Google API | Service name |
---|---|
Google Analytics Data APIs | analytics |
Google Apps APIs (Domain Information & Management) |
apps |
Google Sites Data API | jotspot |
Blogger Data API | blogger |
Book Search Data API | print |
Calendar Data API | cl |
Google Code Search Data API | codesearch |
Contacts Data API | cp |
Content API for Shopping | structuredcontent |
Documents List Data API | writely |
Finance Data API | finance |
Gmail Atom feed | mail |
Health Data API | health weaver (H9 sandbox) |
Maps Data APIs | local |
Picasa Web Albums Data API | lh2 |
Sidewiki Data API | annotateweb |
Spreadsheets Data API | wise |
Webmaster Tools API | sitemaps |
YouTube Data API | youtube |
For more information on the other parameters used in a ClientLogin request, see the ClientLogin documentation.
scope
parameter is required by AuthSub and OAuth 1 to identify
which Google service(s) your application will have access to. For OAuth 2.0 details,
see the documentation for your specific API.
Google API | ClientLogin Service Name |
---|---|
Google Analytics Data API | https://www.google.com/analytics/feeds/ |
Google Sites Data API | http(s)://sites.google.com/feeds/ |
Blogger Data API | http://www.blogger.com/feeds/ |
Book Search Data API | http://www.google.com/books/feeds/ |
Calendar Data API | http(s)://www.google.com/calendar/feeds/ |
Contacts Data API | http(s)://www.google.com/m8/feeds/ |
Content API for Shopping | https://www.googleapis.com/auth/structuredcontent |
Documents List Data API | http(s)://docs.google.com/feeds/ |
Finance Data API | http://finance.google.com/finance/feeds/ |
Gmail Atom feed | https://mail.google.com/mail/feed/atom/ |
Health Data API | https://www.google.com/health/feeds/ https://www.google.com/h9/feeds/ (H9 sandbox) |
Maps Data API | http://maps.google.com/maps/feeds/ |
Picasa Web Albums Data API | http://picasaweb.google.com/data/ |
Portable Contacts API | http://www-opensocial.googleusercontent.com/api/people |
Sidewiki Data API | http://www.google.com/sidewiki/feeds/ |
Spreadsheets Data API | http(s)://spreadsheets.google.com/feeds/ |
Webmaster Tools API | http://www.google.com/webmasters/tools/feeds/ |
YouTube Data API | http://gdata.youtube.com |
AuthSubRevokeToken
API
call. A single use token can only be exchanged for a session token if the original AuthSubRequest
URL
specified session=1
as a query parameter. AuthSub is designed for web applications. It ensures that user credentials are securely sent directly from a user's web browser to Google's servers rather than through a 3rd party web site.
ClientLogin is for installed desktop applications. It requires the requesting application to transmit user credentials to Google on behalf of the user.
See the documentation on Google Account Authentication API.
default
to mean "the user whose authentication
token I am using."The Java, .NET, Python and Objective-C client libraries are officially supported by Google. In addition, our partner Zend has written a PHP client library. Using these libraries, you can construct Google Data protocol requests, send them to a service, and process server responses. There is also a JavaScript client library that currently only supports Blogger, Calendar, and Google Contacts.
If you write a client library in a language other than Java, .Net, Python or Objective-C, and would like to share with the Data API developer community, post in the Google Data APIs discussion group. We would love to hear from you!
Bugs or feature requests for the client libraries can be reported at the following locations:
After posting your bug, create a thread in the developer forum for the appropriate API.
Client Library | Reference Guide |
---|---|
Java | Javadoc |
JavaScript | JSdoc |
.NET | NDoc |
PHP | phpDoc |
Python | PyDoc |
There are a number of tools listed below, but you may also want to read the article On the Wire: Network Capture Tools for API Developers which describes in depth examples of both WireShark and Fiddler.
The Java client libraries use the java.util.logging
package to
enable logging of HTTP requests. This will allow you to enable logging of headers
for requests and responses, as well as status codes and request URLs. It does
not currently log the full request and response streams. The logger name used
for these logs is com.google.gdata.client.http.HttpGDataRequest
.
In the case that an error code is returned from the servers, an Exception
is thrown. The exception classes inherit from com.google.gdata.util.ServiceException
and
include a public method called getResponseBody()
. Look at the Javadoc for
more information.
System.Diagnostics
tracing methods to
log the path of execution, if tracing is enabled. Also, in the case of an error,
a GDataRequestException
is thrown. The exception contains a ResponseString
which
allows you to access the body of the HTTP response.In order to receive a gzip encoded response from one of the Google Data APIs you must do two things: set an "Accept-Encoding" header and modify your user agent to contain the string "gzip". An example of properly formed headers:
User-Agent: my program (gzip) Accept-Encoding: gzip
Beginning July 2009, we began to disable SSLv2 on our servers as a precautionary measure to improve security. Unfortunately, there is a bug in early versions of the PHP client library released before July 2007 (version 1.0.0 and earlier) that forces connections to use SSLv2. When connecting to a server that has SSLv2 disabled, this results in the following error:
PHP Fatal error: Uncaught exception 'Zend_Http_Client_Adapter_Exception' with message 'Unable to Connect to sslv2://www.google.com:443.'
To correct this error, upgrade to a newer release of the PHP client library, available from http://framework.zend.com/download.
If you are unable to upgrade to a newer release, you can fix this by adding
the following code to your application, where $gdata
is your existing
instance of Zend_Gdata
(or appropriate subclass):
$gdata->getHttpClient()->setConfig(array('ssltransport' => 'ssl'));
You can get the Atom service document by passing the alt=atom-service
parameter
in the request. Note: Only version 2 of the Google Data APIs will return
a service document that conforms to the AtomPub
service document syntax. The version 1 of the Google Data APIs will still
return a service document but it is based upon an earlier AtomPub draft specification
(there are syntax and namespace changes between the two versions).