The Google Drive API "browses" the folder to find out which file was added

I have a test endpoint running, and when I drop the file into the folder Iโ€™m viewing, I get a request with a header X-Goog-Resource-State: update, but I donโ€™t seem to get the identifier for the added file.

  • I get X-Goog-Resource-Id, which I thought might be a new file, but I get 404 if I try get()it
  • I get X-Goog-Resource-Uri, but it refers to the folder Iโ€™ve watched
  • I get X-Goog-Channel-Id, but it clearly belongs to the channel, not the file
  • And X-Request-Id, but this is an opaque UUID

Do I need to get a complete list of files for the folder being viewed with each update and compare with the saved list? This is not so, but I am at a loss.

Any guidance would be greatly appreciated.

+4
source share
2 answers

I was in the same situation and ended up transferring the identifier of the folder (file) being viewed to the field of tokenthe viewing channel. When an event occurs, I select the list of files included in this folder. I do not need to compare with any other list, since all new files do not belong to my default account, so they were easy to find, but in your case you could search for files created in the last seconds / minutes, or use private properties for all processed files and search for all missing property files.

+1
source

? , .

, . , : . " ", , " ". , - , , , - .

, , !

+1

Source: https://habr.com/ru/post/1612523/


All Articles