Google Drive Activity API 簡介
Google Drive Activity API 包含 DriveActivity
資源,用於代表使用者 Google 雲端硬碟中物件的異動,以及 activity.query
方法,可讓您擷取這些異動的相關資訊。
要求
應用程式會使用 activity.query
方法要求使用者的活動資料。您可以要求查看特定雲端硬碟項目的活動,也可以要求查看雲端硬碟資料夾下方的所有項目活動。針對特定要求,您可以選擇依據限制條件 (例如時間範圍或動作類型) 限制回應,也可以選擇在回應中合併活動。詳情請參閱「在 Drive Activity API 中提出要求」。
回應
要求的回應是符合指定參數的活動清單,其中 DriveActivity
資源代表每項活動:
DriveActivity
資源是 Action
物件的集合,每個物件都像事件一樣是獨立的。Action
包含 ActionDetail
(例如 Create
或 Edit
)、Actor
(例如 User
或 Administrator
)、Target
(例如 DriveItem
或 Drive
),以及 Timestamp
或 TimeRange
。
DriveActivity
資源也包含摘要資訊,例如所有動作的每個 Actor
和 Target
、統一的 Timestamp
或 TimeRange
,以及 Action
中最重要的或代表性的 ActionDetail
。
詳情請參閱 Drive Activity API 資料模型。
活動記錄瀏覽權限
使用這個 API 時,系統可能不會回報部分雲端硬碟活動。Drive Activity API 是否會回報物件的特定變更,取決於應用程式中已驗證使用者是否可看到該變更或變更相關資訊。
可見度取決於為物件設定的權限。在雲端硬碟中共用檔案和資料夾時,可能會發生以下幾種情況:
- 如果作者共用文件,除了文件建立者之外,共用文件的已驗證使用者也能查看文件的活動記錄。
- 如果文件與使用者共用,然後設為私密,經過驗證的使用者就能在有權存取時查看所有活動記錄,且權限現已受限。
- 如果文件從未與使用者共用,使用者就無法查看任何活動記錄。
開始使用
如要充分運用 Drive Activity API,請先將應用程式與 Google Drive API 整合。如要開始使用 Drive Activity API,請瞭解如何建立專案和授權要求。或者,您也可以直接前往 API 參考資料,瞭解活動的相關資訊。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-12-22 (世界標準時間)。
[null,null,["上次更新時間:2024-12-22 (世界標準時間)。"],[[["The Google Drive Activity API lets you track changes to files and folders in a user's Google Drive using the `DriveActivity` resource and `activity.query` method."],["You can request activity data for specific Drive items or entire folders, filtering results by time range, action type, and more."],["Each `DriveActivity` resource represents a change and includes details like the action performed, the user involved, and the target file or folder."],["Activity visibility depends on user permissions; you can only see activity for files and folders you have access to."],["To effectively utilize the Drive Activity API, it's recommended to integrate it with the Google Drive API for comprehensive file management capabilities."]]],["The Google Drive Activity API uses the `DriveActivity` resource to represent changes in a user's Google Drive. The `activity.query` method retrieves this data for specific items or folders. Requests can be filtered by time, action type, and responses can be consolidated. Each `DriveActivity` resource is a collection of `Action` objects that contain details like `ActionDetail`, `Actor`, and `Target`. Visibility of activity history depends on the authenticated user's permissions and sharing settings.\n"]]