What should I request the Gmail API to get email statistics?

风格不统一 提交于 2021-02-08 10:25:50

问题


I am interested in getting the number of emails sent and received(in priority inbox) on the current day. Nothing more.

Using the REST API in Google App Script.


回答1:


GET https://www.googleapis.com/gmail/v1/users/your_email%40gmail.com/messages?labelIds=SENT&q=newer_than%3A1d&key={YOUR_API_KEY}

To get the number of messages received/sent in the last 24 hours, you can use the gmail.users.messages.list API. You must specify the following query: newer_than:1d to only get a list of emails that were recieved/sent in the past 24 hours. You must also specify which label to query in (INBOX or SENT). Please refer to the following screenshot. You can test it out for yourself here.



来源:https://stackoverflow.com/questions/34377226/what-should-i-request-the-gmail-api-to-get-email-statistics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!