管理員活動報表

管理員活動報告會傳回所有帳戶管理員的管理控制台活動相關資訊。每份報表都會使用基本報表端點要求以及報表專用參數,例如管理員名稱或特定的管理控制台事件。每份報表的時間範圍最長為過去 180 天。

管理員活動報告只能依《客戶協議》的合法用途使用。此外,這些報告適用於 Google Workspace、Education 和 ISP 帳戶。

擷取所有管理活動

如要擷取帳戶中所有管理活動的報告,請使用以下 GET HTTP 要求,並加入授權說明文件中所述的授權權杖。如要進一步瞭解要求的查詢字串和回應屬性,請參閱 API 參考資料。為了方便閱讀,以下範例採用換行格式:

GET https://admin.googleapis.com/admin/reports/v1/activity/users/all
/applications/admin?endTime=a date&startTime=a date
&maxResults=number of events listed on each page of the report

以下範例會取得帳戶過去 180 天 (也就是報表時間上限) 內所有帳戶管理活動的報表。而 maxResults 查詢字串代表這份報表在每個報表頁麵包含兩個事件。如需 API 回應範例,請參閱 JSON 回應範例

GET https://admin.googleapis.com/admin/reports/v1/activity/users/all
/applications/admin?maxResults=2

以下範例取得客戶在過去 180 天內所有管理活動的報表。customerId 會指定要擷取報表的客戶。

GET https://admin.googleapis.com/admin/reports/v1/activity/users/all
/applications/admin?customerId=C03az79cb

擷取管理員的所有活動

如要擷取特定管理員執行的所有管理控制台活動報告,請使用下列 GET HTTP 要求,並附上授權說明文件中所述的授權權杖。userKey 是報表中的管理員主要電子郵件地址。如要進一步瞭解要求的查詢字串和回應屬性,請參閱 API 參考資料。為了方便閱讀,以下範例採用換行格式:

GET https://admin.googleapis.com/admin/reports/v1/activity/users/userKey
/applications/admin?endTime=a date&startTime=a date
&maxResults=number of events listed on each page of the report
&filters=event name parameter relational operator parameter value

以下範例會回報 john@example.com 對管理控制台應用程式進行的所有變更,並篩選回應,傳回 OLD_VALUE 等於 ALLOW_CAMERA 的所有活動。如需 API 回應範例,請參閱 JSON 回應範例。如需活動相關資訊,請參閱管理員事件名稱

GET https://admin.googleapis.com/admin/reports/v1/activity/users/john@example.com
/applications/admin?maxResults=2&filters=OLD_VALUE==ALLOW_CAMERA

按事件名稱擷取所有活動

如要擷取特定事件名稱所有活動的報表,請使用下列 GET HTTP 要求,並加入授權說明文件中所述的授權權杖。如需 eventName 相關資訊,請參閱管理員事件名稱參考資料。如要進一步瞭解要求的查詢字串和回應屬性,請參閱 API 參考資料。為了方便閱讀,以下範例採用換行格式:

GET https://admin.googleapis.com/admin/reports/v1/activity/users/all
/applications/admin?endTime=a date&startTime=a date
&maxResults=maximum number of events returned on a response page
&eventName=name of the administrative event

以下範例會擷取管理控制台中所有變更使用者姓氏的報告。如需 API 回應範例,請參閱 JSON 回應範例

GET https://admin.googleapis.com/admin/reports/v1/activity/users/all
/applications/admin?maxResults=1&eventName=CHANGE_LAST_NAME

依事件和管理員擷取所有活動

如要擷取管理控制台針對特定事件名稱的所有變更報告,請使用以下 GET HTTP 要求,並加入授權說明文件中所述的授權權杖。userKey 是報表中的管理員主要電子郵件地址。如需 eventName 相關資訊,請參閱管理員事件名稱參考資料。如要進一步瞭解要求的查詢字串和回應屬性,請參閱 API 參考資料。為了方便閱讀,以下範例採用換行格式:

GET https://admin.googleapis.com/admin/reports/v1/activity/users/userKey
/applications/admin?endTime=a date&startTime=a date
&maxResults=maximum number of events returned on a response page
&eventName=name of the administrative event

以下範例會擷取在 john@example.com 之前,變更於特定使用者姓氏的所有管理控制台報表。如需 API 回應範例,請參閱 JSON 回應範例

GET https://admin.googleapis.com/admin/reports/v1/activity/users/john@example.com
/applications/admin?maxResults=1&eventName=CHANGE_LAST_NAME

管理員活動報告 JSON 回應範例

成功的回應會傳回 HTTP 200 狀態碼。回應會傳回狀態碼,以及傳回報告。如需 eventName 相關資訊,請參閱管理員事件名稱參考資料。如要進一步瞭解要求的網址查詢字串和回應屬性,請參閱 API 參考資料

{
 "kind": "reports#auditActivities",
 "nextPageToken": "the next page's token",
 "items": [
  {
   "kind": "audit#activity",
   "id": {
    "time": "2011-06-17T15:39:18.460Z",
    "uniqueQualifier": "report's unique ID",
    "applicationName": "admin",
    "customerId": "C03az79cb"
   },
   "actor": {
    "callerType": "USER",
    "email": "liz@example.com",
    "profileId": "user's unique Google Workspace profile ID",
    "key": "consumer key of requestor in OAuth 2LO requests"
   },
   "ownerDomain": "example.com",
   "ipAddress": "user's IP address",
   "events": [
    {
     "type": "GROUP_SETTINGS",
     "name": "CHANGE_GROUP_SETTING",
     "parameters": [
      {
        "name": "SETTING_NAME",
        "value": "WHO_CAN_JOIN",
        "intValue": "integer value of parameter",
        "boolValue": "boolean value of parameter"
      }
     ]
    }
   ]
  },
  {
   "kind": "audit#activity",
   "id": {
    "time": "2011-06-17T15:39:18.460Z",
    "uniqueQualifier": "reports unique ID",
    "applicationName": "admin",
    "customerId": "C03az79cb"
   },
   "actor": {
    "callerType": "USER",
    "email": "liz@example.com",
    "profileId": "user's unique Google Workspace profile ID",
    "key": "consumer key of requestor in an OAuth 2LO request"
   },
   "ownerDomain": "example.com",
   "ipAddress": "user's IP address",
   "events": [
    {
     "type": "GROUP_SETTINGS",
     "name": "CREATE_GROUP",
     "parameters": [
      {
        "name": "GROUP_EMAIL",
        "value": "helpdesk@example.com",
        "intValue": "",
        "boolValue": ""
       }
      ]
     }
    ]
   }
  ]
 }