1

How to get difference read and unread from mail list's using Gamil api javascript.i have used gmail api v1 javascript, but it's display overall rows list.

Thanks,

  • Try this url : https://developers.google.com/gmail/api/release-notes and https://developers.google.com/gmail/api/v1/reference/users/labels – Rax Shah Aug 06 '16 at 09:53

2 Answers2

0

When listing messages, you can give a custom search query in the q query parameter. Just set the value to is:unread to get unread messages, or !is:unread to get read messages:

Request

GET https://www.googleapis.com/gmail/v1/users/me/messages?q=is%3Aunread&access_token={YOUR_ACCESS_TOKEN}

Response

{
 "messages": [
  {
   "id": "1565ad3af8dbd82e",
   "threadId": "1565ad3af8dbd82e"
  }
 ],
 "resultSizeEstimate": 1
}
Tholle
  • 108,070
  • 19
  • 198
  • 189
0

Its worked for me: https://www.googleapis.com/gmail/v1/users/{yourgmailid}/messages?q=is:unread

In headers:- Content-Type: application/json Authorization: Bearer Accept : application/json