开发者

Google API Hooks, is there a way to be Programmatically Alerted When a Google Doc is Updated?

Does Google have an API for registering hooks/callbacks for whenever a document is updated? That way, I could run a process on one of my se开发者_如何学Gorvers every time a doc was updated.

If they don't have that, what the recommended way to accomplish that? Cron? Anything else?


Unfortunately, there is no mechanism for having Google execute hooks against others' systems. However, in this case I recommend you use a cron to pull the documents list feed. To make your life easier, you should probably also use the updated-min query parameter with the feed. This way, you can run a cron every 5 minutes, and give an updated-min date of 6 minutes ago. The additional minute is to avoid race conditions, so you might see some overlap in what's returned after multiple runs of the cron.

An example:

# Assuming it's 10:55:00, you would make a request for 6 minutes ago
https://docs.google.com/feeds/default/private/full/?updated-min=2010-04-03T10:49:00-08:00

For more information, please see the Documents List Data API Reference Guide. Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜