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