Search code examples
google-cloud-platformgmailgmail-apigoogle-cloud-pubsub

Is gmail watch API idempotent?


I am using Gmail watch API to listen to user's inbox updates. Whenever a new email comes on user mailbox, Google sends it on my webhook.

Question:

Is this API idempotent?

Explanation:

I mean if I call this API twice. Will it create two watches on the inbox and I will receive each update two times? or it will only create 1 watch on the user's inbox regardless of how many times I call this API.


Solution

  • Converting my comment into an answer.

    Going through the link shared by Kessy in the comment cleared my concerns about the duplication of listeners. So It means that it just refreshes the watch whenever I call it. Whether after 7 days, or multiple times a day. It will only refresh the watch. That makes the API idempotent.