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


Call For Code 2024 Focuses On Generative AI
01/03/2024

This year's Call for Code challenge has been launched with a theme of the use of generative AI technology for solutions that aim to improve equitable access to resources and opportunities for historic [ ... ]



Quantum Computers Really Are A One Trick Pony
17/03/2024

Google is offering $5 million if you can think up a use for a quantum computer. Wait, I thought quantum computers were the next big thing, a revolution! Surely we know what they can do?


More News

 

raspberry pi books

 

Comments




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

Last Updated ( Tuesday, 01 July 2014 )