Gmail Gets A Restful API
Gmail Gets A Restful API
Written by Ian Elliot   
Tuesday, 01 July 2014

Why exactly does Gmail need an a Restful API? Isn't IMAP or POP3 enough? 

Google has announced another way to get your email from Gmail. The new Gmail API is a Restful API that, obviously, can be used in any language that supports HTTP which is, equally obviously, most of them.



You can already interact with Gmail using IMAP and POP3 so why do you need an additional API? What is more you can even script Gmail using App Script to automate many Gmail tasks.

The new API is in fact a lot like the App Script document model. You can read, send and delete email using it and you can interact with email using the thread structure and labels. You have to make use of OAuth 2 to authenticate and you have to ask for a particular permission level - full access, read, modify and compose. 

Emails are sent in base64 encoded form and this makes things a little more complicated when you are reading or composing a new email. ??However, there are client libraries that cover up the fact that you are using a Restful API for most popular languages - Java, .NET, JavaScript, Objective-C, PHP, and Python. There are also early alpha libraries for Go, Node.js and Ruby. 

So why a new API?

According to the Apps Developer Blog:

"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."

You can also discover Google's viewpoint in the following video: 


All very reasonable and the RESTful approach is also claimed to be faster than IMAP. 

If you are thinking of writing an app that works with Gmail then there is no question that the new API is the way to go but... 

You need to keep in mind that the Gmail API is just that - a Gmail API. If you create an app that uses IMAP then it should work with any mailbox that is IMAP enabled, i.e. most. If you choose to work with the Gmail API then you are locked into Gmail. What is more, if a user wants your app then they better have a Gmail account. 

Could this have been at least part of the motivation for the new API?  Replacing a standard API by a proprietary one is in Google's best interests, but to be fair IMAP is still supported. 






Free AI Course from Finland

There's a new online resource for gaining a basic understanding of AI. It comes from Helsinki University and tech strategy firm Reaktor, who say they want to make Finland the world's most educate [ ... ]

Bombe Goes On Display To Celebrate Alan Turing Anniversary

Today, on the 106th anniversary of the birth of Alan Turing, the UK National Museum of Computing is opening a gallery dedicated to the Bombe. Designed by Turing, this electro-mechanical machine was us [ ... ]

More News






or email your comment to:

Last Updated ( Tuesday, 01 July 2014 )

RSS feed of news items only
I Programmer News
Copyright © 2018 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.