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.

 

googledevs

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. 

googledevsicon

 

 

 

Banner


Kafka 4 Adds Queue Semantics Support
17/04/2025

Kafka 4.0 has been released, with major changes. This is the first version to operate entirely in KRaft mode by default. It also adds a new consumer group protocol designed to dramatically improve reb [ ... ]



Google Redesigns Play Console
18/04/2025

Google has updated its Play Console to provide developers with a dashboard for workflows and new metrics. Play Console is Google's tool for developers where subscribers can manage the apps and games t [ ... ]


More News

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 01 July 2014 )