Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Google Launches Gmail API Beta

Google Launches Gmail API Beta

Leia em Português

This item in japanese

At the last Google I/O Google has introduced a new Gmail API aimed at "giving developers flexible, RESTful access to the user's inbox, with a natural interface to Threads, Messages, Labels, Drafts, and History", and bringing developers multiple benefits over IMAP, says Google.

The objective of the Gmail API is not killing the IMAP protocol, as was initially misunderstood, but to make Gmail application development easier. As Google itself says, "the Gmail API should not be used to replace IMAP for full-fledged email client access."

The new Gmail API will not offer full access to Gmail inbox, as detailed on Google's blog, and will be restricted to:

  • Reading messages from Gmail.
  • Sending email messages.
  • Modifying the labels applied to messages and threads.
  • Searching for specific messages and threads.

The new API gives RESTful access to a user’s mailbox under OAuth 2.0 authorization and supports CRUD operations on true Gmail datatypes such as threads, messages, labels, drafts, and history. The API gives fine-grained control to a user’s mailbox, so that if an app only needs to send mail on behalf of a user and does not need to read mail, the app may be authorized through OAuth to only send mail. This is a benefit offered by the Gmail API in contrast to IMAP, which requires access to all of a user’s messages for all operations, as Eric DeFriez, of the Gmail Extensibility Team, remarks on Google's blog.

Another benefit of the Gmail API, continues DeFriez, comes from the API history feature, which allows to query the inbox change history. This will make it much easier to keep in sync the inbox "avoiding the need to do archaeology to figure out what changed."

The major benefit of the new API, though, is speed, according to DeFriez: "results from our tests and feedback from pre-release developers suggest that the new Gmail API is delivering dramatic performance improvements over IMAP for web application use cases."

Google provides client libraries for Gmail API for several languages, such as Java, JavaScript, .NET, Python, Objective-C, and PHP. Early-stage client libraries are also available for Go, Node.js, and Ruby.

Besides client libraries, Google also provides a quickstart guides in Java and Python.

Rate this Article