Introducing the new Gmail API

Wednesday, June 25, 2014 | 11:00 AM

Labels:

For a while now, many of you have been asking for a better way to access data to build apps that integrate with Gmail. 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, which is why this week at Google I/O, we’re launching the beta of the new Gmail API.

Designed to let you easily deliver Gmail-enabled features, this new API is a standard Google API, which gives RESTful access to a user’s mailbox under OAuth 2.0 authorization. It supports CRUD operations on true Gmail datatypes such as messages, threads, labels and drafts.

As a standard Google API, you make simple HTTPS calls and get your responses in JSON, XML or Google Protobuf formats. You can also make these calls from standard web languages like Java and Python without using a TCP socket, which means the API is accessible from many 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. 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 you to query the inbox change history, thereby avoiding the need to do “archaeology” to figure out what changed.

Finally, a huge benefit is speed. While there’s still some tuning to be done (“beta” - remember?), 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.

Check out the launch video and get started with samples, tutorials, and API references at https://developers.google.com/gmail/api/. We can’t wait to see what you build.

Posted by Eric DeFriez, Gmail Extensibility Team. As a technical lead for Gmail APIs, Eric works to make it easy for developers to build on top of Gmail.

7 comments:

rufo said...

"While IMAP is great at what it was designed for (connecting email clients to email servers in a standard way)" -- presumably you don't have any plans to deprecate this use of IMAP then? Or does this announcement apply to any and all Gmail access over IMAP? (If so, will this also apply to Google Apps email users?)

donkey said...

Sounds like a neat idea! Does that mean the Gmail IMAP implementation can be made to adhere to the IMAP standard so our "connecting email clients" does happen in a standard way?

stepehn s. said...

Can you please build in public-private key encryption when sending/receiving via this API and between two gmail addresses?

Joe Tierney said...

Awesome!!!

niu tech said...

Why not use a new open standard API, preferably RESTful, rather than own proprietary API? This new standard could be used by any mail provider for free.

James said...

@niu tech:
"The Gmail API gives you flexible, RESTful access to the user's inbox, with a natural interface to Threads, Messages, Labels, Drafts, and History."

Wow...didn't even bother to take a look first huh? First sentence even.

niu tech said...

@James, you didn't get me. I know Gmail API is RESTful, but it's Gmail-only and proprietary. I was asking why not use a universal open standard, so that the same API could be used with any other mail provider. Just like POP, IMAP or Z-push are open.