संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस गाइड में, Google Drive Activity API में रिस्पॉन्स के मुख्य कॉम्पोनेंट के बारे में बताया गया है. साथ ही, उदाहरण दिए गए हैं और उन्हें समझने का तरीका भी बताया गया है.
ऑब्जेक्ट
DriveActivity: यह Drive पर गतिविधि के बारे में बताने वाले एपीआई को की गई क्वेरी से मिलने वाला मुख्य संसाधन है. इसमें एक या एक से ज़्यादा उपयोगकर्ताओं के बारे में जानकारी दी जाती है. ये उपयोगकर्ता एक या एक से ज़्यादा कार्रवाइयां करते हैं, जिनका असर एक या एक से ज़्यादा टारगेट पर पड़ता है.
Timestamp और TimeRange: इनसे पता चलता है कि गतिविधि कब हुई या किसी समयावधि के दौरान गतिविधि कब शुरू और कब खत्म हुई.
Actor: आम तौर पर, Actor एक असली उपयोगकर्ता होता है.
हालांकि, कभी-कभी सिस्टम इवेंट, Action को ट्रिगर कर सकता है. ऐसा तब होता है, जब कोई एडमिन उपयोगकर्ता या खुद के तौर पर काम कर रहा हो या जब कोई ऐसा व्यक्ति काम कर रहा हो जिसकी पहचान नहीं की जा सकती. Actor
मैसेज में इन सभी मामलों के बारे में बताया गया है.
Target: Target किसी गतिविधि का ऑब्जेक्ट होता है. जैसे, फ़ाइल, फ़ोल्डर, शेयर की गई ड्राइव या फ़ाइल पर की गई टिप्पणी. ध्यान दें कि कई तरह की कार्रवाइयां, एक से ज़्यादा तरह के टारगेट के साथ काम करती हैं. उदाहरण के लिए, Edit आम तौर पर Drive की फ़ाइलों पर लागू होता है. हालांकि, Rename और Create जैसी अन्य कार्रवाइयां, Drive के फ़ोल्डर और शेयर की गई ड्राइव पर भी लागू हो सकती हैं. Drive के आइटम नहीं होने पर भी टारगेट, Drive के किसी आइटम का रेफ़रंस दे सकते हैं. जैसे, किसी Drive के रूट फ़ोल्डर या उस पैरंट दस्तावेज़ का रेफ़रंस जिसमें फ़ाइल की टिप्पणी मौजूद है.
Action: हर DriveActivity संसाधन में एक या उससे ज़्यादा मिलती-जुलती कार्रवाइयां होती हैं. Action, इवेंट की तरह ही एक ऐसा एलिमेंट है जिसमें कार्रवाई के बारे में पूरी जानकारी और टाइप शामिल होता है. साथ ही, इसमें Actor, Target, और Timestamp या TimeRange भी शामिल होता है. डुप्लीकेट डेटा से बचने के लिए, Action अपने Target, Actor या समय फ़ील्ड में वैल्यू नहीं डालता, जब वे पूरी DriveActivity के जैसे हों.
ActionDetail: यह Action के बारे में खास जानकारी और उसका टाइप है. उदाहरण के लिए, Move ऐक्शन की जानकारी में सोर्स और डेस्टिनेशन की जगह की जानकारी होती है. साथ ही, PermissionChange से यह पता चलता है कि अब कौनसे लोग किसी दस्तावेज़ को ऐक्सेस कर सकते हैं और किन विशेषाधिकारों के साथ.
जवाब के उदाहरण
जवाबों के सैंपल देखने के लिए, यहां दी गई जानकारी देखें.
किसी उपयोगकर्ता ने Drive में मौजूद किसी फ़ाइल में बदलाव किया
किसी DriveActivity संसाधन में सिर्फ़ एक कार्रवाई शामिल हो सकती है, जैसे कि कोई उपयोगकर्ता किसी फ़ाइल में बदलाव कर रहा है.
ACCOUNT_ID: उपयोगकर्ता का आईडी. ज़्यादा जानकारी पाने के लिए, इसका इस्तेमाल
People API के साथ किया जा सकता है.
ITEM_ID: Drive में मौजूद आइटम का आईडी.
TITLE: Drive आइटम का टाइटल.
ध्यान दें कि इस रिस्पॉन्स में मौजूद Action ऑब्जेक्ट में Actor,
Target या timestamp शामिल नहीं है, क्योंकि ये सभी ऑब्जेक्ट, पूरी तरह से DriveActivity ऑब्जेक्ट के जैसे ही होते हैं.
दो उपयोगकर्ताओं ने एक ही फ़ाइल में एक ही समय पर बदलाव किया
ConsolidationStrategy का इस्तेमाल करने पर, मिलती-जुलती कार्रवाइयों को एक साथ DriveActivity में रखा जाता है. इस उदाहरण में, दो मिलती-जुलती कार्रवाइयों को एक ग्रुप में रखा गया है: दो अलग-अलग उपयोगकर्ताओं की एक Edit कार्रवाई का टाइप.
ACCOUNT_ID_1: पहले उपयोगकर्ता का आईडी. ज़्यादा जानकारी पाने के लिए, इसका इस्तेमाल People API के साथ किया जा सकता है.
ACCOUNT_ID_2: दूसरे उपयोगकर्ता का आईडी.
ITEM_ID: Drive में मौजूद आइटम का आईडी.
TITLE: Drive आइटम का टाइटल.
ध्यान दें कि इस रिस्पॉन्स में मौजूद Action ऑब्जेक्ट में Target शामिल नहीं है, क्योंकि यह कुल DriveActivity के बराबर है.
इस उदाहरण से यह भी पता चलता है कि ऐप्लिकेशन, अलग-अलग कार्रवाइयों को देखे बिना, DriveActivity में सिर्फ़ खास जानकारी का इस्तेमाल कैसे कर सकते हैं. जवाब से पता चलता है कि दो उपयोगकर्ताओं ने किसी फ़ाइल में, एक तय समयावधि के दौरान बदलाव किया है.
किसी उपयोगकर्ता ने दो फ़ाइलों को नई डायरेक्ट्री में ले जाया
इस उदाहरण में, ConsolidationStrategy ने मिलती-जुलती दो Move कार्रवाइयों को एक ग्रुप में रखा है, क्योंकि फ़ाइलों को एक ही सोर्स से एक ही डेस्टिनेशन पर एक ही समय में ट्रांसफ़र किया गया था.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 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`."]]