0

How do I monitor changes to a particular folder in Google drive using drive Java API?

I am trying the code below, but it give changes for complete drive.

I need the changes for one particular folder

StartPageToken response = service.changes().getStartPageToken().execute();
System.out.println("Start token: " + response.getStartPageToken());
Daniel
  • 10,641
  • 12
  • 47
  • 85
rasf s
  • 21
  • 4

1 Answers1

0

Use changes/watch, where resourceId should be the fileId of the directory to watch - while from the client-side, this is pretty useless - because one has to set parameter address, which should be an URL.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • I am using changes only but how to set resource ID here – rasf s May 22 '19 at 04:34
  • see: [Changes](https://developers.google.com/resources/api-libraries/documentation/drive/v3/java/latest/com/google/api/services/drive/Drive.Changes.html) and [Channel.setResourceId()](https://developers.google.com/resources/api-libraries/documentation/drive/v3/java/latest/com/google/api/services/drive/model/Channel.html#setResourceId-java.lang.String-). – Martin Zeitler May 22 '19 at 10:12