تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يوضّح هذا الدليل المكوّنات الرئيسية للاستجابة في Google Drive Activity API، ويقدّم أمثلة وكيفية تفسيرها.
العناصر
DriveActivity: هذا هو المرجع الأساسي
الذي تعرضه طلبات البحث التي يتم إجراؤها على Drive Activity API. ويصف الإجراء واحدًا
أو أكثر من الجهات التي تُنفّذ إجراءً واحدًا أو أكثر يؤثر في هدف واحد أو أكثر.
Timestamp
وTimeRange: يصف هذان الرمزان،
على التوالي، إما نقطة زمنية واحدة حدث فيها النشاط، أو
بداية النشاط وانتهائه على مدار فترة زمنية.
Actor: عادةً ما يكون Actor مستخدمًا نهائيًا.
ومع ذلك، في بعض الأحيان، يمكن أن يؤدي حدث نظام إلى بدء Action عندما يتصرّف مشرف بصفته مستخدمًا أو باسمه، أو عندما ينفّذ الإجراء شخص غير محدّد الهوية. تتضمن رسالة Actor
كل حالة من هذه الحالات.
Target: Target هو عنصر
نشاط، مثل ملف أو مجلد أو مساحة تخزين سحابي مشتركة أو تعليق على ملف. يُرجى العلم
أنّ العديد من أنواع الإجراءات تتيح أكثر من نوع واحد من الاستهدافات. على سبيل المثال،
على الرغم من أنّ الإجراء Edit ينطبق بشكل عام على ملفات Drive، يمكن أيضًا تطبيق إجراءات أخرى،
مثل Rename وCreate، على مجلدات Drive
ومساحات التخزين السحابي المشتركة. لا يزال بإمكان الاستهدافات التي ليست عناصر في Drive
الإشارة إلى عنصر، مثل المجلد الجذر لمساحة تخزين سحابي أو المستند الرئيسي
الذي يحتوي على تعليق ملف.
Action: يحتوي كل مورد DriveActivity على
إجراء واحد أو أكثر ذي صلة. يكون العنصر Action مكتفيًا ذاتيًا، مثل
الحدث، إذ لا يتضمّن النوع المفصّل والمعلومات
عن الإجراء فحسب، بل يتضمّن أيضًا Actor وTarget وTimestamp
أو TimeRange. لتجنُّب التكرار، لا تملأ Action حقول
Target أو Actor أو الوقت الخاصة بها عندما تكون هذه الحقول متطابقة مع
DriveActivity العام.
ActionDetail: هذا هو النوع المحدّد
والمعلومات التفصيلية عن Action. على سبيل المثال، يحتوي detail الخاص بإجراء 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 مرتبطَين
لأنّه تم نقل الملفات من المصدر نفسه إلى الوجهة نفسها في
الوقت نفسه.
تاريخ التعديل الأخير: 2025-03-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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`."]]