Google unveils new Gmail API
New API gives RESTful access to a user's mailbox under OAuth 2.0 authorisation
At yesteday's I/O developer conference, Google took the wraps off a new Gmail API, which will allow developers to provide Gmail-enabled features within their own apps.
The new API, available in beta mode now, is a standard Google API which gives RESTful access to a user's mailbox under OAuth 2.0 authorisation. It supports CRUD operations on true Gmail databases such as messages, threads, labels and drafts, Google said.
"For a while now, many of you have been asking for a better way to access data to build apps that integrate with Gmail," wrote Eric DeFriez, technical lead for Gmail APIs, in a blog post on the new API.
"While IMAP is great at what it was designed for (connecting email clients to email servers in a standard way), it wasn't really designed to do all of the cool things that you have been working on."
DeFriez said that, as a standard Google API, developers can make simple HTTPS calls and get responses in JSON, XML or Google Protobuf formats. He added that it is possible to make these calls from standard web languages like Java and Python without using a TCP socket, which means the API is accessible from cloud environments that couldn't support IMAP.
"In contrast to IMAP, which requires access to all of a user's messages for all operations, the new API gives fine-grained control to a user's mailbox," he wrote.
"For example, if your app only needs to send mail on behalf of a user and does not need to read mail, you can limit your permission request to send-only."
To keep in sync, the API allows apps to query the inbox change history, thereby avoiding the need to do ‘archaeology' to work out what has changed, DeFriez added.
Finally, he said that the new API would deliver a boost in speed. While admitting that there was still some fine-tuning to be done, he said that the new API was delivering "dramatic" performance increases over IMAP for web application use cases.