I'm testing out Google Drive 'Changes' API and have some questions.
Expectation: I've folder tree structure under 'My Drive' with files in them. I would like to call the Changes:list API to detect if items have been added/edited/deleted within that specific folder id.
APIs Explorer tried: https://developers.google.com/drive/v2/reference/changes/list
Questions:
I don't see any option to pass a specific folder id to this API for getting the 'largestChangeId'. Looks like this api doesn't support the parm 'q'? Is it possible?
As an alternate solution, thought of storing the 'modifiedDate' attribute for that folder and use it for comparing next time. But, it's not getting updated when items are updated within that folder. Should it not work like in windows where folder modified date gets updated when its contents gets updated?
Would like to hear if it's possible to detect changes at folder level.
Thanks
[EDIT]
Solution that worked:
Use Files:list to list all. selected fields: items/id,items/modifiedDate,items/parents/id,items/title
Get starting folder id ( e.g for 'MyRootFolder' using Title search)
- Traverse through the sub-tree structure (linking parents:id and file Id) using recursive array search and get max modifiedDate and total file counts.
- Store max modifiedDate and file counts in the app storage.
- For subsequent calls, compare the new max modifiedDate with the stored and also compare total file counts with the stored. If either one doesn't match, then contents within 'MyRootFolder' has been updated.