How Gmail API's Quota Units Work? -
according gmail's api docs, limits follows:
api limit type limit daily usage 1,000,000,000 quota units per day per user rate limit 250 quota units per user per second, moving average (allows short bursts)
in table further below, docs messages.get
costs 5 quota units.
in case, interesting in polling inbox every second check new messages, , contents of messages if there any.
question 1: mean i'd spending 5 quota units each second, , i'd under quota?
question 2: how should check "new" messages? is, messages have arrived since last time made api call? need add "read" labels messages after each api call (spending quota units on "modify" api call), or there easier way?
question 1:
that's right. spend (5 * 60 * 60 * 24 =) 432000
quota points on polling, near limit. implement push notifications if want google notify of new messages rather polling yourself.
question 2:
listing messages has undocumented feature of querying messages after timestamp, given in seconds since epoch.
if messages after sun, 29 may 2016 07:00:00 gmt, give the value after:1464505200
in q
query parameter.
Comments
Post a Comment