Jeff McKay
Jeff McKay

Reputation: 295

Correct email data for Google Group API media upload

I am trying to use the Google Groups Migration API to add an entry to a Google Group. According to the documentation I use this url:

https://www.googleapis.com/upload/groups/v1/groups/groupId/archive?uploadType=media

I am supplying the auth token correctly I think (got past http 401 error). Now I am getting http 500, internal server error. My http headers are:

Content-Length: 291
Content-Type: message/rfc822

The data that follows is as plain a rfc822 type message as I can make:

From: "John Doe" <[email protected]>
To: "Jane Doe" <[email protected]>
Subject: forward test
MIME-Version: 1.0
Date: Fri, 19 Feb 2016 08:03:00 -0800
Content-Type: message/rfc822

This is the first line of the forward test.

I have some other code that creates messages in Gmail folders, that works fine. For that, I do "uploadType=multipart", and create my data in json format. I've tried doing that as well for Groups but no luck. Any ideas?

Upvotes: 2

Views: 179

Answers (1)

Tholle
Tholle

Reputation: 112787

The Content-Type of the request is message/rfc822 as you say, but the actual plain text part of your message is not:

Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
To: [email protected]
From: [email protected]
Subject: Subject Text

The actual message text goes here

Upvotes: 2

Related Questions