Drive Activity API 데이터 모델
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 가이드에서는 Google Drive Activity API의 응답의 주요 구성요소를 설명하고 예시와 이를 해석하는 방법을 보여줍니다.
객체
DriveActivity
: Drive Activity API 쿼리에서 반환되는 기본 리소스입니다. 하나 이상의 타겟에 영향을 미치는 하나 이상의 작업을 실행하는 하나 이상의 행위자를 설명합니다.
Timestamp
및 TimeRange
: 각각 활동이 발생한 특정 시점 또는 일정 기간 동안 활동이 발생한 시작과 종료를 나타냅니다.
Actor
: 일반적으로 Actor
는 최종 사용자입니다.
하지만 관리자가 사용자 또는 본인으로서 작업을 하거나 알 수 없는 사용자가 작업을 수행할 때 시스템 이벤트가 Action
를 트리거할 수도 있습니다. Actor
메시지는 이러한 각 사례를 캡슐화합니다.
Target
: Target
는 파일, 폴더, 공유 드라이브, 파일 댓글과 같은 활동의 객체입니다. 많은 작업 유형이 두 가지 이상의 대상 유형을 지원합니다. 예를 들어 Edit
는 일반적으로 Drive 파일에 적용되지만 Rename
및 Create
와 같은 다른 작업은 Drive 폴더 및 공유 드라이브에도 적용할 수 있습니다. Drive 항목이 아닌 타겟도 Drive의 루트 폴더나 파일 댓글이 포함된 상위 문서와 같이 Drive 항목을 참조할 수 있습니다.
Action
: 각 DriveActivity
리소스에는 하나 이상의 관련 작업이 있습니다. Action
는 작업에 관한 자세한 유형 및 정보뿐만 아니라 Actor
, Target
, Timestamp
또는 TimeRange
도 포함하는 이벤트와 같이 독립형입니다. 중복을 방지하기 위해 Action
는 전체 DriveActivity
와 동일한 경우 자체 Target
, Actor
또는 시간 필드를 채우지 않습니다.
ActionDetail
: Action
의 구체적인 유형 및 세부정보입니다. 예를 들어 Move
작업 세부정보에는 소스 및 대상 위치가 있고 PermissionChange
는 이제 문서에 액세스할 수 있는 사용자와 권한을 지정합니다.
응답 예
다음을 검토하여 샘플 응답을 확인하세요.
사용자가 Drive에서 파일을 수정함
DriveActivity
리소스에는 사용자가 하나의 파일을 수정하는 것과 같은 하나의 작업만 포함될 수 있습니다.
"activities":[{
"primaryActionDetail":{ "edit":{} },
"actors":[ { "user":{ "knownUser":{ "personName":"people/ACCOUNT_ID" } } } ],
"targets":[ { "driveItem":{ "name":"items/ITEM_ID", "title":"TITLE", "file":{} } } ],
"timestamp":{ "seconds":"1536794657", "nanos":791000000 },
"actions":[ { "detail":{ "edit":{} } } ]
}]
이 출력에는 다음 값이 포함됩니다.
- ACCOUNT_ID: 사용자의 ID입니다.
People API와 함께 사용하여 자세한 정보를 얻을 수 있습니다.
- ITEM_ID: Drive 항목의 ID입니다.
- TITLE: Drive 항목의 제목입니다.
이 응답의 Action
객체에는 Actor
, Target
또는 timestamp
가 포함되지 않습니다. 전체 DriveActivity
와 동일하기 때문입니다.
두 사용자가 비슷한 시간에 동일한 파일을 수정함
ConsolidationStrategy
를 사용하면 관련 작업이 하나의 결합된 DriveActivity
로 그룹화됩니다. 이 예에서는 두 명의 서로 다른 사용자의 Edit
작업 유형 1개씩, 총 2개의 유사한 작업이 그룹화되어 있습니다.
"activities":[{
"primaryActionDetail":{ "edit":{} },
"actors":[
{ "user":{ "knownUser":{ "personName":"people/ACCOUNT_ID_1" } } },
{ "user":{ "knownUser":{ "personName":"people/ACCOUNT_ID_2" } } }
],
"targets":[
{ "driveItem":{ "name":"items/ITEM_ID", "title":"TITLE", "file":{} } }
],
"timeRange":{
"startTime":{ "seconds":"1541089823", "nanos":712000000 },
"endTime":{ "seconds":"1541089830", "nanos":830000000 }
},
"actions":[
{
"detail":{ "edit":{} },
"actor":{ "user":{ "knownUser":{ "personName":"people/ACCOUNT_ID_1" } } },
"timestamp":{ "seconds":"1541089830", "nanos":830000000 }
},
{
"detail":{ "edit":{} },
"actor":{ "user":{ "knownUser":{ "personName":"people/ACCOUNT_ID_2" } } },
"timestamp":{ "seconds":"1541089823", "nanos":712000000 }
}
]
}]
이 출력에는 다음 값이 포함됩니다.
- ACCOUNT_ID_1: 첫 번째 사용자의 ID입니다. People API와 함께 사용하여 자세한 정보를 얻을 수 있습니다.
- ACCOUNT_ID_2: 두 번째 사용자의 ID입니다.
- ITEM_ID: Drive 항목의 ID입니다.
- TITLE: Drive 항목의 제목입니다.
이 응답의 Action
객체에는 Target
가 포함되어 있지 않습니다. 전체 DriveActivity
와 동일하기 때문입니다.
또한 이 예는 앱이 개별 작업을 확인하지 않고 DriveActivity
의 요약 정보만 사용하는 방법을 보여줍니다. 응답은 두 사용자가 일정 기간 동안 특정 파일을 수정했음을 나타냅니다.
사용자가 두 파일을 새 디렉터리로 이동했습니다.
이 예에서는 파일이 동일한 소스에서 동일한 대상으로 동시에 이동되었기 때문에 ConsolidationStrategy
가 두 개의 관련 Move
작업을 그룹화했습니다.
"activities":[{
"primaryActionDetail":{
"move":{
"addedParents":[ { ... } ]
"removedParents":[ { ... } ]
}
},
"actors":[ { "user":{ "knownUser":{ "personName":"people/ACCOUNT_ID" } } } ],
"targets":[
{ "driveItem":{ "name":"items/ITEM_ID_1", "title":"TITLE_1", "file":{} } },
{ "driveItem":{ "name":"items/ITEM_ID_2", "title":"* TITLE_2", "file":{} } }
],
"timestamp":{ "seconds":"1541090960", "nanos":985000000 },
"actions":[
{
"detail":{ "move":{ "addedParents":[ { ... } ] "removedParents":[ { ... } ] } },
"target":{ "driveItem":{ "name":"items/ITEM_ID_1", "title":"TITLE_1", "file":{} } }
},
{
"detail":{ "move":{ "addedParents":[ { ... } ] "removedParents":[ { ... } ] } },
"target":{ "driveItem":{ "name":"items/ITEM_ID_2", "title":"* TITLE_2", "file":{} } }
}
]
}]
이 출력에는 다음 값이 포함됩니다.
- ACCOUNT_ID: 사용자의 ID입니다.
People API와 함께 사용하여 자세한 정보를 얻을 수 있습니다.
- ITEM_ID_1: 첫 번째 Drive 항목의 ID입니다.
- ITEM_ID_2: 두 번째 Drive 항목의 ID입니다.
- TITLE_1: 첫 번째 Drive 항목의 제목입니다.
- TITLE_2: 두 번째 Drive 항목의 제목입니다.
이 응답의 Action
객체에는 Actor
또는 timestamp
가 포함되지 않습니다. 전체 DriveActivity
와 동일하기 때문입니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-03-26(UTC)
[null,null,["최종 업데이트: 2025-03-26(UTC)"],[],[],null,["# Drive Activity API data model\n\nThis guide explains the main components of a response in the Google Drive Activity API,\nshowing examples and how to interpret them.\n\nObjects\n-------\n\n- [`DriveActivity`](/drive/activity/v2/reference/rest/v2/activity/driveactivity): This is the primary\n resource returned by queries to the Drive Activity API. It describes one\n or more actors performing one or more actions affecting one or more targets.\n\n- [`Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)\n and [`TimeRange`](/drive/activity/v2/reference/rest/v2/activity/timerange): These describe,\n respectively, either a single point in time when the activity occurred, or\n the start and end of when the activity occurred over a span of time.\n\n- [`Actor`](/drive/activity/v2/reference/rest/v2/activity/actor): Typically, an `Actor` is an end user.\n However, sometimes, a system event can trigger an [`Action`](/drive/activity/v2/reference/rest/v2/activity/action) when an administrator is acting as a user or as\n themselves, or when performed by an unidentifiable person. The `Actor`\n message encapsulates each of these cases.\n\n- [`Target`](/drive/activity/v2/reference/rest/v2/activity/target): A `Target` is the object of an\n activity, like a file, a folder, a shared drive, or a file comment. Note\n that many action types support more than one kind of target. For example,\n though `Edit` generally applies to Drive files, other actions\n like `Rename` and `Create` can also apply to Drive folders\n and shared drives. Targets that aren't Drive items can still\n refer to one, such as the root folder of a drive or the parent document\n containing a file comment.\n\n- [`Action`](/drive/activity/v2/reference/rest/v2/activity/action): Each `DriveActivity` resource has one\n or more related actions. An `Action` is self-contained, like an\n *event* , in that it comprises not only the detailed type and information\n about the action, but also an `Actor`, a `Target`, and either a `Timestamp`\n or `TimeRange`. To avoid redundancy, an `Action` doesn't populate its own\n `Target`, `Actor`, or time fields when those are the same as the overall\n `DriveActivity`.\n\n- [`ActionDetail`](/drive/activity/v2/reference/rest/v2/activity/actiondetail): This is the specific type\n and detailed information about an `Action`. For example, a `Move` action\n detail has a source and destination location, and a `PermissionChange`\n specifies who can now access a document and with what privileges.\n\nExample responses\n-----------------\n\nReview the following to see sample responses.\n\n### A user edited a file in Drive\n\nA `DriveActivity` resource might include only one action, such as a user\nediting one file. \n\n \"activities\":[{\n \"primaryActionDetail\":{ \"edit\":{} },\n \"actors\":[ { \"user\":{ \"knownUser\":{ \"personName\":\"people/\u003cvar translate=\"no\"\u003eACCOUNT_ID\u003c/var\u003e\" } } } ],\n \"targets\":[ { \"driveItem\":{ \"name\":\"items/\u003cvar translate=\"no\"\u003eITEM_ID\u003c/var\u003e\", \"title\":\"\u003cvar translate=\"no\"\u003eTITLE\u003c/var\u003e\", \"file\":{} } } ],\n \"timestamp\":{ \"seconds\":\"1536794657\", \"nanos\":791000000 },\n \"actions\":[ { \"detail\":{ \"edit\":{} } } ]\n }]\n\nThis output includes the following values:\n\n- \u003cvar translate=\"no\"\u003eACCOUNT_ID\u003c/var\u003e: the ID of the user. It can be used with the [People API](/people) to get more information.\n- \u003cvar translate=\"no\"\u003eITEM_ID\u003c/var\u003e: the ID of the Drive item.\n- \u003cvar translate=\"no\"\u003eTITLE\u003c/var\u003e: the title of the Drive item.\n\nNote that the `Action` object in this response doesn't include the `Actor`,\n`Target`, or `timestamp` because they're the same as the overall\n`DriveActivity`.\n\n### Two users edited the same file at similar times\n\nWhen a [`ConsolidationStrategy`](/drive/activity/v2/reference/rest/v2/activity/query#consolidationstrategy)\nis used, related actions are grouped into one combined `DriveActivity`. In this\nexample, two similar actions are grouped: one `Edit` action type from two\ndifferent users. \n\n \"activities\":[{\n \"primaryActionDetail\":{ \"edit\":{} },\n \"actors\":[\n { \"user\":{ \"knownUser\":{ \"personName\":\"people/\u003cvar translate=\"no\"\u003eACCOUNT_ID_1\u003c/var\u003e\" } } },\n { \"user\":{ \"knownUser\":{ \"personName\":\"people/\u003cvar translate=\"no\"\u003eACCOUNT_ID_2\u003c/var\u003e\" } } }\n ],\n \"targets\":[\n { \"driveItem\":{ \"name\":\"items/\u003cvar translate=\"no\"\u003eITEM_ID\u003c/var\u003e\", \"title\":\"\u003cvar translate=\"no\"\u003eTITLE\u003c/var\u003e\", \"file\":{} } }\n ],\n \"timeRange\":{\n \"startTime\":{ \"seconds\":\"1541089823\", \"nanos\":712000000 },\n \"endTime\":{ \"seconds\":\"1541089830\", \"nanos\":830000000 }\n },\n \"actions\":[\n {\n \"detail\":{ \"edit\":{} },\n \"actor\":{ \"user\":{ \"knownUser\":{ \"personName\":\"people/\u003cvar translate=\"no\"\u003eACCOUNT_ID_1\u003c/var\u003e\" } } },\n \"timestamp\":{ \"seconds\":\"1541089830\", \"nanos\":830000000 }\n },\n {\n \"detail\":{ \"edit\":{} },\n \"actor\":{ \"user\":{ \"knownUser\":{ \"personName\":\"people/\u003cvar translate=\"no\"\u003eACCOUNT_ID_2\u003c/var\u003e\" } } },\n \"timestamp\":{ \"seconds\":\"1541089823\", \"nanos\":712000000 }\n }\n ]\n }]\n\nThis output includes the following values:\n\n- \u003cvar translate=\"no\"\u003eACCOUNT_ID_1\u003c/var\u003e: the ID of the first user. It can be used with the [People API](/people) to get more information.\n- \u003cvar translate=\"no\"\u003eACCOUNT_ID_2\u003c/var\u003e: the ID of the second user.\n- \u003cvar translate=\"no\"\u003eITEM_ID\u003c/var\u003e: the ID of the Drive item.\n- \u003cvar translate=\"no\"\u003eTITLE\u003c/var\u003e: the title of the Drive item.\n\nNote that the `Action` object in this response doesn't include the `Target`\nbecause it's the same as the overall `DriveActivity`.\n\nThe example also illustrates how apps might use only the summary information in\n`DriveActivity`, without looking at the individual actions. The response\nindicates that two users edited a given file over a span of time.\n\n### A user moved two files into a new directory\n\nIn this example, the `ConsolidationStrategy` grouped two related `Move` actions\nbecause the files were moved from the same source to the same destination at the\nsame time. \n\n \"activities\":[{\n \"primaryActionDetail\":{\n \"move\":{\n \"addedParents\":[ { ... } ]\n \"removedParents\":[ { ... } ]\n }\n },\n \"actors\":[ { \"user\":{ \"knownUser\":{ \"personName\":\"people/\u003cvar translate=\"no\"\u003eACCOUNT_ID\u003c/var\u003e\" } } } ],\n \"targets\":[\n { \"driveItem\":{ \"name\":\"items/\u003cvar translate=\"no\"\u003eITEM_ID_1\u003c/var\u003e\", \"title\":\"\u003cvar translate=\"no\"\u003eTITLE_1\u003c/var\u003e\", \"file\":{} } },\n { \"driveItem\":{ \"name\":\"items/\u003cvar translate=\"no\"\u003eITEM_ID_2\u003c/var\u003e\", \"title\":\"* \u003cvar translate=\"no\"\u003eTITLE_2\u003c/var\u003e\", \"file\":{} } }\n ],\n \"timestamp\":{ \"seconds\":\"1541090960\", \"nanos\":985000000 },\n \"actions\":[\n {\n \"detail\":{ \"move\":{ \"addedParents\":[ { ... } ] \"removedParents\":[ { ... } ] } },\n \"target\":{ \"driveItem\":{ \"name\":\"items/\u003cvar translate=\"no\"\u003eITEM_ID_1\u003c/var\u003e\", \"title\":\"\u003cvar translate=\"no\"\u003eTITLE_1\u003c/var\u003e\", \"file\":{} } }\n },\n {\n \"detail\":{ \"move\":{ \"addedParents\":[ { ... } ] \"removedParents\":[ { ... } ] } },\n \"target\":{ \"driveItem\":{ \"name\":\"items/\u003cvar translate=\"no\"\u003eITEM_ID_2\u003c/var\u003e\", \"title\":\"* \u003cvar translate=\"no\"\u003eTITLE_2\u003c/var\u003e\", \"file\":{} } }\n }\n ]\n }]\n\nThis output includes the following values:\n\n- \u003cvar translate=\"no\"\u003eACCOUNT_ID\u003c/var\u003e: the ID of the user. It can be used with the [People API](/people) to get more information.\n- \u003cvar translate=\"no\"\u003eITEM_ID_1\u003c/var\u003e: the ID of the first Drive item.\n- \u003cvar translate=\"no\"\u003eITEM_ID_2\u003c/var\u003e: the ID of the second Drive item.\n- \u003cvar translate=\"no\"\u003eTITLE_1\u003c/var\u003e: the title of the first Drive item.\n- \u003cvar translate=\"no\"\u003eTITLE_2\u003c/var\u003e: the title of the second Drive item.\n\nNote that the `Action` object in this response doesn't include the `Actor` or\n`timestamp` because they're the same as the overall `DriveActivity`."]]