I'm currently trying to test the new Gmail REST API.
In the API Explorer it is possible to authorize requests using OAuth 2.0 and to execute a request, i.e. send a message.
First I authorized.
I'm using the following test data (and of course I used a valid to
email address):
{
"raw": "c2VuZGluZyBhIG1haWwgdXNpbmcgR21haWwgUkVTVCBBUEk=",
"payload": {
"headers": [
{ "name": "to", "value": "[email protected]" },
{ "name": "from", "value": "[email protected]" },
{ "name": "subject", "value": "Test Gmail REST API" }
],
"mimeType": "text/plain"
}
}
I also get a 200 OK
and the following result back, which looks fine.
{
"id": "146dee391881b35b",
"threadId": "146dee391881b35b",
}
However, the mail will not be sent successfully and I can find an message from [email protected]
in the inbox instead;: "An error occurred, your message has not been sent."
Questions:
1. Did someone test this successfully?
2. Do I have to add some other parameter to get this running?
EDIT: There are 2 different HTTP request methods,
- the Upload URI for media upload requests, and
- the Metadata URI for metadata-only requests
The API Explorer currently supports metadata requests only
, which means plain-text messages without attachment, and this is what I'm trying to do.
200 OK
back... – Sari