crucifix94
crucifix94

Reputation: 203

Can we add multiple labelId in history.list API for gmail?

I want to get the result of all INBOX mails and all SENT mails in one API call using the historyID and the history.list Gmail-API. Refer: https://developers.google.com/gmail/api/v1/reference/users/history/list

When I am hitting the following GET request : https://www.googleapis.com/gmail/v1/users/{userID}/history?startHistoryId={historyID}&labelId=SENT&labelId=INBOX

I only get the SENT label messages. Seems like the API only accepts single & first query param for labelId.

Is there a way to get multiple labelIds' response in a single API call?

Upvotes: 1

Views: 276

Answers (1)

Mr.Rebot
Mr.Rebot

Reputation: 6791

I think it would not be possible, I tried making a multiple request and it this response:

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

I would suggest to call it separately for each labelID but you can try filing a feature request for this.

Hope this helps.

Upvotes: 0

Related Questions