Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
A API Google Drive Activity consiste no recurso
DriveActivity, que
representa as mudanças feitas em objetos no Google Drive de um usuário, e no método
activity.query, que permite recuperar
informações sobre essas mudanças.
Solicitação
O app solicita os dados de atividade de um usuário usando o método
activity.query. Você pode solicitar a atividade de um item específico do Drive ou de tudo o que está em uma pasta do Drive. Para uma determinada solicitação, é possível restringir a resposta por restrições, como período ou tipo de ação, e consolidar a atividade na resposta. Para mais informações, consulte Fazer solicitações na API Drive Activity.
Resposta
A resposta a uma solicitação é uma lista de atividades que correspondem aos parâmetros fornecidos, em que um recurso DriveActivity representa cada atividade:
Um recurso DriveActivity é uma coleção de objetos Action, cada um independente como um evento. Um Action inclui um
ActionDetail (como Create
ou Edit), um Actor (como User
ou Administrator), um Target (como
DriveItem ou Drive) e um
Timestamp
ou TimeRange.
Um recurso DriveActivity também contém informações de resumo, como todos os Actor e Target de todas as ações, um Timestamp ou TimeRange unificado e o ActionDetail mais importante ou representativo do Action.
Algumas atividades no Drive podem não ser informadas quando você usa essa API. Se a API Drive Activity informa uma determinada mudança em um objeto depende de se a mudança ou as informações sobre ela estão visíveis para o usuário autenticado no seu aplicativo.
A visibilidade é baseada nas permissões definidas para o objeto. Há vários cenários em que arquivos e pastas são compartilhados no Drive:
Se um autor compartilhar um documento, o histórico de atividades dele
ficará visível não apenas para o criador, mas também para os usuários autenticados
com quem ele foi compartilhado.
Se um documento foi compartilhado com um usuário e depois se tornou particular, o usuário autenticado
pode ver todo o histórico de atividades enquanto tinha acesso e que as permissões agora estão
restringidas.
Se um documento nunca foi compartilhado com um usuário, ele não poderá ver o histórico de atividades.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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)."]]