I have integrated google drive into my application. To achieve sync, I have also configured push notifications for each account by following the steps in the link https://developers.google.com/drive/v3/web/push
Below is the java code to configure watch on all files for the account
String uuid = UUID.randomUUID().toString();
Channel channel = new Channel();
channel.setId(uuid);
channel.setType("web_hook");
channel.setAddress(env.getProperty("webhookUrl"));
StartPageToken pageToken = service.changes().getStartPageToken().execute();
Channel response = service.changes().watch(pageToken.getStartPageToken(), channel).execute();
On making changes in the actual google drive, I get the notification in the webhook url configured above.
But the problem is for every change, I am getting the same values for below headers which are same as the response of the watch call & I am not getting any proper request headers corresponding to the change or request body
//Getting request headers
String resourceId = request.getHeader("X-Goog-Resource-ID");
String resourceState = request.getHeader("X-Goog-Resource-State");
String expiration = request.getHeader("X-Goog-Channel-Expiration");
String resourceChanges = request.getHeader("X-Goog-Changed");
String channelId = request.getHeader("X-Goog-Channel-ID");
Can someone please let me know how do i get notification data correctly ? Is there anything I am doing wrong ?
Here is the same problem stated by another question which does not have proper answer yet Receiving Google Drive Push Notifications