Gmail’s API provides RESTful access to threads, messages, drafts and labels as it extends the capabilities of IMAP to meet modern email use cases. It allows developers to add Gmail features such as read/send emails, search for specific message threads, and modify thread labels, directly into third-party applications using OAuth2.0 for authentication and authorisation.
Where IMAP required access to all of your emails to perform even a single function, the API respects the sensitivity of private data by providing access only to the function intended. For example, if you wanted to authorise a mobile application to send messages on your behalf, invoking the Gmail API can provide this feature without needing to retrieve incoming messages. This quickstart tutorial on Google Developers shows followers how to build a simple iOS application that makes requests to the Gmail API.
The quickstart requires Xcode 4.2 or higher, the CocoaPods dependency manager and a Google account with Gmail enabled. Followers get step-by-step notes on preparing the project in Xcode to contain the sample app, which is set up in the workspace’s project navigator. The first time you run the sample you will be prompted to log in to your Google account and authorise access, which gets stored in your Keychain so you won’t be prompted again.
All of the relevant code is provided, with links to other quickstarts showing how to build the same application for other platforms.
