user.messages.get responding invalid ID

Viewed 2606

when attempting to test out the api explorer for user.messages: get I have been getting an invalid message ID response.

I am getting the message ID from a recent email in my inbox sent to me, and removed the <> from either ends.

response:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalidArgument",
    "message": "Invalid id value"
   }
  ],
  "code": 400,
  "message": "Invalid id value"
 }
}

I am a bit confused as I am using the powershell module gshell and noticed that the same messageID worked in my commands but returned invalid id value in the api explorer.

edit: if I do a inbox search for rfc822msgid:[messageID] it returns the correct message

2 Answers

First you have to call the users.messages.list api. It will give a list of messageids. Then we have to call users.message.get api with each messageid to fetch the mail content. You can query the mails with advanced search options provided by Gmail API.

Related