קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
Google Drive Activity API מורכב ממקור המידע DriveActivity, שמייצג שינויים שבוצעו באובייקטים ב-Google Drive של משתמש, ומהשיטה activity.query, שמאפשרת לאחזר מידע על השינויים האלה.
בקשה
האפליקציה מבקשת את נתוני הפעילות של המשתמש באמצעות השיטה activity.query. אתם יכולים לבקש פעילות לגבי פריט ספציפי ב-Drive או לגבי כל מה שנמצא בתיקייה ב-Drive. לכל בקשה, אפשר לבחור להגביל את התגובה באמצעות אילוצים כמו טווח זמן או סוג פעולה, ואפשר לבחור לאחד את הפעילות בתגובה. מידע נוסף מופיע במאמר בנושא שליחת בקשות ב-Drive Activity API.
תשובה
התגובה לבקשה היא רשימה של פעילויות שתואמות לפרמטרים שצוינו, כאשר משאב DriveActivity מייצג כל פעילות:
משאב DriveActivity מכיל גם מידע סיכום, כמו כל Actor וTarget מכל הפעולות, Timestamp מאוחד או TimeRange, וגם את ActionDetail הכי חשוב או מייצג של Action.
יכול להיות שחלק מהפעילות ב-Drive לא ידווח כשמשתמשים ב-API הזה. האם ה-API של פעילות ב-Drive מדווח על שינוי מסוים באובייקט תלוי בשאלה אם השינוי או המידע על השינוי גלויים למשתמש המאומת באפליקציה שלכם.
הגישה לאובייקט תלויה בהרשאות שהוגדרו לאובייקט. יש כמה תרחישים שבהם קבצים ותיקיות משותפים ב-Drive:
אם מחבר משתף מסמך, היסטוריית הפעילות של המסמך גלויה לא רק ליוצר, אלא גם למשתמשים מאומתים שהמסמך שותף איתם.
אם מסמך שותף עם משתמש מסוים ואז הוגדר כפרטי, המשתמש המאומת יכול לראות את כל היסטוריית הפעילות בזמן שהייתה לו גישה למסמך, ושההרשאות מוגבלות עכשיו.
אם מסמך אף פעם לא שותף עם משתמש, הוא לא יכול לראות את היסטוריית הפעילות.
שנתחיל?
כדי להפיק את המרב מ-Drive Activity API, כדאי לשלב את האפליקציה שלכם קודם עם Google Drive API. כדי להתחיל להשתמש ב-Drive Activity API, צריך ללמוד איך ליצור פרויקט ולאשר בקשות. אפשר גם לקרוא על פעילויות בהפניית ה-API.
[[["התוכן קל להבנה","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-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)."]]