The Google Drive Activity API consists of the
DriveActivity
resource, which
represents changes made to objects within a user's Google Drive, and the
activity.query
method, which allows you to retrieve
information about those changes.
Request
Your app requests a user's activity data using the
activity.query
method. You can request activity
either for a specific Drive item or for everything contained under a Drive
folder. For a given request, you can choose to restrict the response by
constraints such as time range or action type, and you
can choose to have the activity consolidated in the
response. For more information, see Make requests in the Drive Activity API.
Response
The response to a request is a list of activities matching the given parameters,
where a
DriveActivity
resource represents each activity:
A DriveActivity
resource is a collection of
Action
objects, each of which is
self-contained like an event. An Action
includes an
ActionDetail
(such as Create
or Edit
), an Actor
(such as User
or Administrator
), a Target
(such
as DriveItem
or Drive
), and either a
Timestamp
or TimeRange
.
A DriveActivity
resource also contains
summary information, such as every
Actor
and
Target
from all the actions, a unified
Timestamp
or TimeRange
, and either the most
important or representative
ActionDetail
of the
Action
.
For more information, see the Drive Activity API data model.
Activity history visibility
Some activity on Drive may not be reported when you use this API. Whether the Drive Activity API reports a given change to an object depends on whether the change, or information about the change, is visible to the authenticated user in your application.
Visibility is based on the permissions set for the object. There's several scenarios when files and folders are shared in Drive:
- 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.
- 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.
- If a document was never shared with a user, the user can't see any activity history.
Get started
To get the most out of the Drive Activity API, integrate your app with the Google Drive API first. To get started with the Drive Activity API, learn how to create a project and authorize requests. Or, dive right in and read about activities in the API reference.