I had the success of cloning a "raw" formatted message using getc format='raw'and reinserting it like this:
params = {'userId':'me", 'id': msg_id, 'format':'raw'}
mesg = service.users().messages().get(**params).execute()
body = {'raw': mesg['raw']}
service.users().messages().insert(userId='me', body=**body).execute()
But I really want to do the same, using the json format, which getcan alternatively return via format='full'. Something like that:
params = {'userId':'me", 'id': msg_id, 'format':'full'}
mesg = service.users().messages().get(**params).execute()
body = mesg
service.users().messages().insert(userId='me', body=**body).execute()
See below format mesg[1]. Doing the above gives me an error:
HttpError: <HttpError 400 when requesting
https://www.googleapis.com/gmail/v1/users/me/messages?alt=json
returned "
'raw' RFC822 payload message string or uploading message via /upload/*
URL required
">
So the question is:
How do I insertpost through the "full" json format?
"" "", URL- ? ?
json raw ?
, , ?
, upload ?
?
?
.
get
insert
[1] get . , - insert.
{u'historyId': u'5226', u'id': u'148af993efc00bce',
u'snippet': u'Hi Joe Get the official Gmail app The best features of Gmail are only available on your phone and',
u'sizeEstimate': 4809, u'threadId': u'148af993efc00bce', u'labelIds': [u'INBOX'],
u'payload': {u'mimeType': u'multipart/alternative', u'headers': [
{u'name': u'MIME-Version', u'value': u'1.0'},
{u'name': u'x-no-auto-attachment', u'value': u'1'},
{u'name':
{u'historyId': u'5226',
u'id': u'148af993efc00bce',
u'snippet': u'Hi Joe Get the official Gmail app The best features of Gmail are only available on your phone and',
u'sizeEstimate': 4809,
u'threadId': u'148af993efc00bce',
u'labelIds': [u'INBOX'], u'payload': {
u'mimeType': u'multipart/alternative',
u'headers': [{u'name': u'MIME-Version',
u'value': u'1.0'}, {
u'name': u'x-no-auto-attachment',
u'value': u'1'},
{u'name': u'Received',
u'value': u'by 10.31.41.213; Thu, 25 Sep 2014 18:35:28 -0700 (PDT)'},
{u'name': u'Date',
u'value': u'Thu, 25 Sep 2014 18:35:28 -0700'},
{u'name': u'Message-ID',
u'value': u'<CAJvL7e8jz9WYNUjHgnmYcyFgySXxjLiH1zjMxOfopURZmAy4iA@mail.gmail.com>'},
{u'name': u'Subject',
u'value': u'The best of Gmail, wherever you are'},
{u'name': u'From',
u'value': u'Gmail Team <mail-noreply@google.com>'},
{u'name': u'To',
u'value': u'Joe Test <test@gmail.com>'},
{u'name': u'Content-Type',
u'value': u'multipart/alternative; boundary=bcaec547c84f9cba4a0503edee6b'}],
u'parts': [{u'mimeType': u'text/plain',
u'headers': [
{u'name': u'Content-Type',
u'value': u'text/plain; charset=UTF-8'},
{
u'name': u'Content-Transfer-Encoding',
u'value': u'quoted-printable'}],
u'body': {
u'data': u'IFRoZSBiZXN0IG9mIEdtYWlsLCB3aGVyZ...