简体   繁体   中英

how to get read and unread message list using gmail api javascript

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,

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
}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM