Email Migration API "must have atom and media part"

17 views
Skip to first unread message

Jeffrey McKay

unread,
Mar 6, 2012, 3:05:31 PM3/6/12
to google-app...@googlegroups.com
I seem to have fixed the problem in my previous post by making sure that the Content-Length header is first in the list.  Now I get server response 400 Bad Request.  The html error says "Multipart must have Atom and media part".  I believe I have copied the example from the developers guide exactly, see below.  Any help appreciated.
 
http headers:
 
Content-Length: 1318
Content-Type: multipart/related;boundary="----=_Part_0_25934938.1266495790627"
Authorization: GoogleLogin auth=DQAAAPMAAAArQJ3iUf2_-dMln8O9NOifzqfQu-...
Post data:
 
------=_Part_0_25934938.1266495790627
Content-Type: application/atom+xml
 
<?xml version=&apos;1.0&apos; encoding=&apos;UTF-8&apos;?><entry xmlns=&apos;http://www.w3.org/2005/Atom&apos;
xmlns:apps=&apos;http://schemas.google.com/apps/2006&apos;>
<category scheme=&apos;http://schemas.google.com/g/2005#kind&apos; term=&apos;http://schemas.google.com/apps/2006#mailItem&apos;/>
<atom:content xmlns:atom=&apos;http://www.w3.org/2005/Atom&apos; type=&apos;message/rfc822&apos;/>
<apps:mailItemProperty value=&apos;IS_INBOX&apos;/>
 
------=_Part_0_25934938.1266495790627
Content-Type: message/rfc822
 
MIME-Version: 1.0
Received: by 10.216.170.147 with HTTP; Fri, 26 Mar 2010 12:54:28 -0700 (PDT)
Date: Sat, 27 Mar 2010 03:54:28 +0800
Delivered-To:
da...@example.com
Message-ID: <203b3a4f1043461254v148...@mail.gmail.com>
Subject: hello multipart
From: Elizabeth Bennet <
ben...@example.com>
To: Fitzwilliam Darcy <
da...@example.com>
Content-Type: multipart/alternative; boundary=000e0cdf7740f8017e0482b9877a
 
--000e0cdf7740f8017e0482b9877a
Content-Type: text/plain; charset=ISO-8859-1
 
howdy multipart!
 
--000e0cdf7740f8017e0482b9877a
Content-Type: text/html; charset=ISO-8859-1
 
howdy multipart!
 
--000e0cdf7740f8017e0482b9877a--
 
------=_Part_0_25934938.1266495790627
 

Claudio Cherubino

unread,
Mar 6, 2012, 4:38:02 PM3/6/12
to google-app...@googlegroups.com
Hi Jeffrey,

I found a similar issue on StackOverflow and the fix was simply to add an empty line separating the headers and the body:


If that is not your case, I'd recommend checking the multipart syntax to verify your code is 100% compliant:


Claudio

 

--
You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-apps-mgmt-apis/-/u8tT6XIpsusJ.
To post to this group, send email to google-app...@googlegroups.com.
To unsubscribe from this group, send email to google-apps-mgmt...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Jeffrey McKay

unread,
Mar 6, 2012, 6:15:01 PM3/6/12
to google-app...@googlegroups.com
I've tried that and just about everything else under the sun... nothing works.  What would really be helpful if if somebody
could post a trace showing exact headers and data sent to the API in a real-world test (i.e. not the example in the
developers guide).  I've posted my latest attempt below if anyone is interested.
 
http headers:
 
Content-Length: 1235
Content-Type: multipart/related; boundary=Part_0_25934938.1266495790627
Authorization: GoogleLogin auth=DQAAAPUAAAB7vtNS...
 
Post data (note there is a CR/LF at the very beginning):
 

--Part_0_25934938.1266495790627
Content-Type: application/atom+xml
 
<?xml version="1.0"; encoding="UTF-8"?>
<entry xmlns="
http://www.w3.org/2005/Atom"
  xmlns:apps="
http://schemas.google.com/apps/2006">
  <category scheme="
http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/apps/2006#mailItem"/>
  <atom:content xmlns:atom="
http://www.w3.org/2005/Atom" type="message/rfc822"/>
  <apps:mailItemProperty value="IS_INBOX"/>
</entry>
 
--Part_0_25934938.1266495790627
Content-Type: message/rfc822
 
MIME-Version: 1.0
Received: by 10.216.170.147 with HTTP; Fri, 26 Mar 2010 12:54:28 -0700 (PDT)
Date: Sat, 27 Mar 2010 03:54:28 +0800
Delivered-To:
da...@example.com
Message-ID: <203b3a4f1043461254v148...@mail.gmail.com>
Subject: hello multipart
From: Elizabeth Bennet <
ben...@example.com>
To: Fitzwilliam Darcy <
da...@example.com>
Content-Type: multipart/alternative; boundary=000e0cdf7740f8017e0482b9877a
 
--000e0cdf7740f8017e0482b9877a
Content-Type: text/plain; charset=ISO-8859-1
 
howdy multipart!
 
--000e0cdf7740f8017e0482b9877a
Content-Type: text/html; charset=ISO-8859-1
 
howdy multipart!
 
--000e0cdf7740f8017e0482b9877a--
 
--Part_0_25934938.1266495790627--

Reply all
Reply to author
Forward
0 new messages