[英]How to list changes in a specific folder using Google Drive API Javascript
我正在使用 Changes:list API 來列出更改。
https://developers.google.com/drive/api/v3/reference/changes/list
但結果包括我驅動器中的所有文件夾。 我想過濾特定文件夾的結果。 在文檔中,我沒有看到像“Files:List”那樣的“changes:list”參數“q”。
有沒有辦法通過 API 參數過濾結果? 或者我是否需要使用我已經知道的“文件夾 ID”在我的代碼中執行此操作?
這是我正在使用的代碼:
var request = gapi.client.drive.changes.list({
//The collection works by providing the current state of each item, if and only if the item has changed since a given point in time.
//point in history to retrive changes, we can saved this to know if there are changes
pageToken: '820167',
//test parameters that are not working
//q: "'12pDb31bRw7p3pfJoF_N6VncDqISSY1W4' in parents",
//q: 'trashed=false and "'+ folderId +'" in parents',
fields: '*',
pageSize: 5,
orderby:'title',
maxResults: 50
});
request.execute(function (resp) {
console.log(resp);
});
我可能會建議改用Drive Activity API ,它可以讓您查詢文件夾中的更改。 您需要指定參數ancestorName=items/${folderId}
。 Drive Activity 還將讓您更深入地了解發生的實際活動。
驅動器更改資源非常少。 它旨在提供對整個驅動器/共享驅動器更改的快速視圖。 它增加的價值是能夠為推送通知設置監視 - 這些可用於觸發進一步的操作。
不幸的是,您想要的無法實現,因為Changes: list
方法返回用戶或共享驅動器的更改列表。
因此,如果要檢索特定文件夾的更改,則必須在之后以編程方式在代碼中對其進行過濾。
您還可以在此處通過 Google 的問題跟蹤器提交功能請求,並提供所有必要的詳細信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.