Google Drive Activity API の概要
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Google Drive Activity API は、ユーザーの Google ドライブ内のオブジェクトに加えられた変更を表す DriveActivity
リソースと、それらの変更に関する情報を取得できる 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
または代表的な ActionDetail
など、概要情報も含まれます。
詳細については、Drive Activity API のデータモデルをご覧ください。
アクティビティ履歴の公開設定
この API を使用すると、ドライブのアクティビティの一部が報告されないことがあります。Drive Activity API がオブジェクトに対する特定の変更を報告するかどうかは、その変更または変更に関する情報がアプリケーションの認証済みユーザーに表示されるかどうかによって異なります。
公開設定は、オブジェクトに設定された権限に基づきます。ドライブでファイルやフォルダを共有するシナリオはいくつかあります。
- 作成者がドキュメントを共有すると、ドキュメントのアクティビティ履歴は作成者だけでなく、共有された認証済みユーザーにも表示されます。
- ドキュメントがユーザーと共有された後で非公開になった場合、認証されたユーザーは、アクセス権があった期間のすべてのアクティビティ履歴と、権限が制限されたことを確認できます。
- ドキュメントがユーザーと共有されたことがない場合、ユーザーはアクティビティ履歴を確認できません。
始める
Drive Activity API を最大限に活用するには、まずアプリを Google Drive API と統合します。Drive Activity API を使用するには、プロジェクトを作成し、リクエストを承認する方法をご確認ください。または、API リファレンスでアクティビティについて直接お読みください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-04 UTC。
[null,null,["最終更新日 2025-08-04 UTC。"],[],[],null,["# Introduction to Google Drive Activity API\n\nThe Google Drive Activity API consists of the\n[`DriveActivity`](/workspace/drive/activity/v2/reference/rest/v2/activity/driveactivity) resource, which\nrepresents changes made to objects within a user's Google Drive, and the\n[`activity.query`](/workspace/drive/activity/v2/reference/rest/v2/activity/query) method, which allows you to retrieve\ninformation about those changes.\n\nRequest\n-------\n\nYour app requests a user's activity data using the\n[`activity.query`](/workspace/drive/activity/v2/reference/rest/v2/activity/query) method. You can request activity\neither for a specific Drive item or for everything contained under a Drive\nfolder. For a given request, you can choose to restrict the response by\n[constraints](/workspace/drive/activity/v2/requests#filters) such as time range or action type, and you\ncan choose to have the activity [consolidated](/workspace/drive/activity/v2/requests#consolidation) in the\nresponse. For more information, see [Make requests in the Drive Activity API](/workspace/drive/activity/v2/requests).\n\nResponse\n--------\n\nThe response to a request is a list of activities matching the given parameters,\nwhere a\n[`DriveActivity`](/workspace/drive/activity/v2/reference/rest/v2/activity/driveactivity) resource represents each activity:\n\nA [`DriveActivity`](/workspace/drive/activity/v2/reference/rest/v2/activity/driveactivity) resource is a collection of\n[`Action`](/workspace/drive/activity/v2/reference/rest/v2/activity/action) objects, each of which is\nself-contained like an *event* . An `Action` includes an\n[`ActionDetail`](/workspace/drive/activity/v2/reference/rest/v2/activity/actiondetail) (such as `Create`\nor `Edit`), an [`Actor`](/workspace/drive/activity/v2/reference/rest/v2/activity/actor) (such as `User`\nor `Administrator`), a [`Target`](/workspace/drive/activity/v2/reference/rest/v2/activity/target) (such\nas `DriveItem` or `Drive`), and either a\n[`Timestamp`](/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp)\nor [`TimeRange`](/workspace/drive/activity/v2/reference/rest/v2/activity/timerange).\n\nA `DriveActivity` resource also contains\nsummary information, such as every\n`Actor` and\n`Target` from all the actions, a unified\n`Timestamp`\nor `TimeRange`, and either the most\nimportant or representative\n`ActionDetail` of the\n`Action`.\n\nFor more information, see the [Drive Activity API data model](/workspace/drive/activity/v2/datamodel).\n\nActivity history visibility\n---------------------------\n\nSome activity on Drive may not be reported when you use this API. Whether the\nDrive Activity API reports a given change to an object depends on whether\nthe change, or information about the change, is visible to the authenticated\nuser in your application.\n\nVisibility is based on the permissions set for the object. There's several\nscenarios when files and folders are shared in Drive:\n\n- If an author shares a document, the activity history for the document is visible to not only the creator, but also to the authenticated users with whom it was shared.\n- If a document was shared with a user and then made private, the authenticated user can see all activity history while they had access and that the permissions are now restricted.\n- If a document was never shared with a user, the user can't see any activity history.\n\nGet started\n-----------\n\nTo get the most out of the Drive Activity API, integrate your app with the\n[Google Drive API](/workspace/drive/api) first. To get started with the Drive Activity API,\nlearn how to [create a project](/workspace/drive/activity/v2/guides/project) and\n[authorize requests](/workspace/guides/configure-oauth-consent). Or, dive right in and read\nabout activities in the\n[API reference](/workspace/drive/activity/v2/reference/rest/v2/activity)."]]