Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the number of unread threads in INBOX with Gmail API?

Tags:

gmail-api

I tried to use the list thread method:

GET https://www.googleapis.com/gmail/v1/users/{MyEmailAddress}/threads?labelIds=INBOX&labelIds=UNREAD&key={YOUR_API_KEY}

The resultSizeEstimate does not match the number next to my inbox in Gmail web app.

Is there another way?

like image 634
yuklai Avatar asked Dec 19 '22 13:12

yuklai


1 Answers

The Gmail API now provides total and unread counts for messages and threads on each Label using the Labels.Get() method. See: https://developers.google.com/gmail/api/release-notes and https://developers.google.com/gmail/api/v1/reference/users/labels

like image 155
Eric D Avatar answered Dec 28 '22 06:12

Eric D