The Google Drive Activity API consists of theDriveActivity
resource, whichrepresents changes made to objects within a user's Google Drive, and theactivity.query
method, which allows you to retrieveinformation about those changes.
Request
Your app requests a user's activity data using theactivity.query
method. You can request activityeither for a specific Drive item or for everything contained under a Drivefolder. For a given request, you can choose to restrict the response byconstraints such as time range or action type, and youcan choose to have the activity consolidated in theresponse. 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 aDriveActivity
resource represents each activity:
A DriveActivity
resource is a collection ofAction
objects, each of which isself-contained like an event. An Action
includes anActionDetail
(such as Create
or Edit
), an Actor
(such as User
or Administrator
), a Target
(suchas DriveItem
or Drive
), and either aTimestamp
or TimeRange
.
A DriveActivity
resource also containssummary information, such as every Actor
andTarget
from all the actions, a unifiedTimestamp
or TimeRange
, and either the mostimportant or representativeActionDetail
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 theDrive Activity API reports a given change to an object depends on whetherthe change, or information about the change, is visible to the authenticateduser in your application.
Visibility is based on the permissions set for the object. There's severalscenarios when files and folders are shared in Drive:
- If an author shares a document, the activity history for the documentis visible to not only the creator, but also to the authenticated userswith whom it was shared.
- If a document was shared with a user and then made private, the authenticateduser 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 activityhistory.
Get started
To get the most out of the Drive Activity API, integrate your app with theGoogle Drive API first. To get started with the Drive Activity API,learn how to create a project andauthorize requests. Or, dive right in and readabout activities in theAPI reference.