After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 654652 - Add support for the Changes feed
Add support for the Changes feed
Status: RESOLVED OBSOLETE
Product: libgdata
Classification: Platform
Component: Google Documents service
git master
Other All
: Normal enhancement
: Drive API
Assigned To: libgdata-maint
libgdata-maint
Depends on:
Blocks:
 
 
Reported: 2011-07-14 22:09 UTC by Philip Withnall
Modified: 2018-09-21 16:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Comment 1 Philip Withnall 2011-08-20 19:05:11 UTC
(Re. discussion at the Desktop Summit:) I think polling this is the best we can hope to get for notification support for changes to documents.
Comment 2 Philip Withnall 2014-08-13 23:33:02 UTC
Google Drive API for it: https://developers.google.com/drive/v2/reference/changes
Comment 3 Debarshi Ray 2015-08-21 12:59:10 UTC
Although related, the Changes API won't exactly let us implement notifications. For that we need the Channels API:
https://developers.google.com/drive/v2/reference/files/watch
https://developers.google.com/drive/v2/reference/channels
Comment 4 Debarshi Ray 2016-07-25 15:32:07 UTC
(In reply to Debarshi Ray from comment #3)
> Although related, the Changes API won't exactly let us implement
> notifications. For that we need the Channels API:
> https://developers.google.com/drive/v2/reference/files/watch
> https://developers.google.com/drive/v2/reference/channels

I was playing with the Channels API using the API Explorer today. The various watch methods (Changes:watch, Files:watch) are supposed to give us a Channel, but I don't think we can make it work with a desktop client because they are based on webhooks [1]

For example, this request:

POST https://www.googleapis.com/drive/v2/changes/watch?key={YOUR_API_KEY}

{
 "id": "gnome:foo",
 "resourceId": "1xLBrDLPPd3wVC-lk3EJrjRRqFLMWsZgBjzWTump0o5I",
 "type": "web_hook",
 "payload": true,
 "address": "https://www.gnome.org/foo"
}

... fails with:

Cache-Control:  private, max-age=0
Content-Encoding:  gzip
Content-Length:  176
Content-Type:  application/json; charset=UTF-8
Date:  Mon, 25 Jul 2016 14:53:49 GMT
Expires:  Mon, 25 Jul 2016 14:53:49 GMT
Server:  GSE
Vary:  Origin, X-Origin
WWW-Authenticate:  Bearer realm="https://accounts.google.com/", error=invalid_token

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "push.webhookUrlUnauthorized",
    "message": "Unauthorized WebHook callback channel: https://www.gnome.org/foo"
   }
  ],
  "code": 401,
  "message": "Unauthorized WebHook callback channel: https://www.gnome.org/foo"
 }
}

[1] https://en.wikipedia.org/wiki/Webhook
Comment 5 Debarshi Ray 2016-07-25 15:35:28 UTC
(In reply to Debarshi Ray from comment #4)
> I was playing with the Channels API using the API Explorer today. The
> various watch methods (Changes:watch, Files:watch) are supposed to give us a
> Channel, but I don't think we can make it work with a desktop client because
> they are based on webhooks [1]

Even if we can't have push notifications via Channels, it could still be worth supporting the Changes API. We can avoid repeatedly downloading the entire metadata while polling a large enough Drive. Unless the contents of the Drive is rapidly changing, this should be more optimal.
Comment 6 Philip Withnall 2016-08-07 07:31:12 UTC
(In reply to Debarshi Ray from comment #4)
> (In reply to Debarshi Ray from comment #3)
> > Although related, the Changes API won't exactly let us implement
> > notifications. For that we need the Channels API:
> > https://developers.google.com/drive/v2/reference/files/watch
> > https://developers.google.com/drive/v2/reference/channels
> 
> I was playing with the Channels API using the API Explorer today. The
> various watch methods (Changes:watch, Files:watch) are supposed to give us a
> Channel, but I don't think we can make it work with a desktop client because
> they are based on webhooks [1]

I think you need to add gnome.org to the list of authorised domains in the Google API control panel to get that webhook call to work:

http://stackoverflow.com/a/24588802/2931197

However, unless we build a push notifications service from gnome.org to every desktop using GNOME Documents, this approach won't work, as you say.

(In reply to Debarshi Ray from comment #5)
> (In reply to Debarshi Ray from comment #4)
> > I was playing with the Channels API using the API Explorer today. The
> > various watch methods (Changes:watch, Files:watch) are supposed to give us a
> > Channel, but I don't think we can make it work with a desktop client because
> > they are based on webhooks [1]
> 
> Even if we can't have push notifications via Channels, it could still be
> worth supporting the Changes API. We can avoid repeatedly downloading the
> entire metadata while polling a large enough Drive. Unless the contents of
> the Drive is rapidly changing, this should be more optimal.

Definitely worth supporting the Changes API. Are you going to get time to work on it?
Comment 7 Ondrej Holy 2017-05-19 13:19:29 UTC
It is not based on Changes API and anyway I think we should build the cache incrementally and we can use Changes API in the future for proper invalidation. I wanted to make just a simple improvement initially based on etags provided by Google. Unfortunately, etags change per each query regardless of actually changes, so I ended up with this bigger patch. Rishi, what do you think?
Comment 8 Ondrej Holy 2017-05-19 13:21:35 UTC
Sorry, this comment was for Bug 771390.
Comment 9 GNOME Infrastructure Team 2018-09-21 16:13:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libgdata/issues/6.