This document provides detailed reference documentation for the Google Apps Email Migration API.
Note: This API is only available to Google Apps Premier, Education, and Partner Edition domains, and cannot be used for migration into Google Apps Standard Edition email or Gmail accounts.
This document is intended for programmers who want to write client applications that can migrate email into Google Apps mailboxes.
It's a reference document; it assumes that you understand the concepts presented in the developer's guide, and the general ideas behind the Google data APIs protocol.
The Email Migration API defines only one type of feed: the mail item feed. In order to access this feed, your client must first authenticate to your Google Apps domain using ClientLogin (Authentication for Installed Apps).
The mail item feed is used to insert mail messages into hosted Gmail accounts associated with a Google Apps domain. Its feed URL is:
https://apps-apis.google.com/a/feeds/migration/2.0/yourDomain.com/username/mail
where yourDomain.com is your Google Apps domain name, and username is the username that will own the message after the migration. The username is only a username, not a full email address; for example, if you're migrating messages to be owned by liz@example.com, the username to use is liz. The Content-Type of the POST request must be application/atom+xml or the server will reply with a 415 Unsupported Media Type status code.
The above feed only allows you to insert messages one at a time. In other words, you must make one HTTP request for each mail message you wish to insert. It is recommended instead that you access the batch mail item feed, which allows you to insert many messages in a single HTTP request. The batch feed has the URL:
https://apps-apis.google.com/a/feeds/migration/2.0/yourDomain.com/username/mail/batch
Both of these feeds are write-only; that is, the only request method they support is HTTP POST.
Note: Only domain administrators can migrate mail to accounts other than their own (by specifying a username other than their own to be used in the above URLs). When an end user is migrating mail, the username in the above URLs must be the same as the currently authenticated username.
In addition to the standard Google data API elements, the Email Migration API uses the following elements.
For information about the standard data API elements, see the Atom specification and the Common Elements document.
A Gmail label to be applied to an inserted mail message.
| Property | Type | Description |
|---|---|---|
@labelName |
xsd:string |
The name of the label, with any special XML characters escaped. |
<apps:label xmlns:apps='http://schemas.google.com/apps/2006' labelName='Friends' />
namespace apps = "http://schemas.google.com/apps/2006"
start = label
label =
element apps:label {
attribute labelName { xsd:string }
}
A special Gmail property to be applied to an inserted mail message.
| Property | Type | Description |
|---|---|---|
@value |
xs:string |
Must be one of the following:
|
<apps:mailItemProperty xmlns:apps='http://schemas.google.com/apps/2006' value='IS_STARRED' />
namespace apps = "http://schemas.google.com/apps/2006"
start = mailItemProperty
mailItemProperty =
element apps:mailItemProperty {
attribute value { "IS_DRAFT" | "IS_INBOX" | "IS_SENT" | "IS_STARRED" |
"IS_TRASH" | "IS_UNREAD" }
}
The RFC 822 content of the mail message to be migrated.
| Property | Type | Description |
|---|---|---|
text() |
xs:string |
The RFC 822 text content of the mail message. |
@encoding? |
xsd:string |
Valid values are none, which is equivalent to not specifying the encoding attribute, and base64, which indicates that the RFC822 message is
encoded in Base64 and should be decoded by the server. |
<apps:rfc822Msg xmlns:apps='http://schemas.google.com/apps/2006'> Received: by 140.23.6.190 with HTTP; Mon, 16 Jul 2007 10:12:26 -0700 (PDT) Message-ID: <c8acb6980707161012i5d395392p5a6d8d14a8582613@mail.gmail.com> Date: Mon, 16 Jul 2007 10:12:26 -0700 From: "Elizabeth Bennet" <liz@example.com> To: "Fitzwilliam Darcy" <darcy@example.com> Subject: Lunch on Monday MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Delivered-To: darcy@example.com This is the body of the email message. Would you like to have lunch this week? </apps:rfc822Msg>
namespace apps = "http://schemas.google.com/apps/2006"
start = rfc822Msg
rfc822Msg =
element apps:rfc822Msg {
attribute encoding { "base64" | "none" }?,
xsd:string
}