Reports API:登入活動報告

登入活動報表會傳回帳戶中所有使用者的登入活動資訊。每份報表都會使用基本報表端點要求,以及使用者電子郵件等報表專屬參數。每份報表的時間範圍上限為過去 180 天。

您只能根據《客戶協議》,將登入活動報表用於合法用途。

擷取網域的 Google Workspace 登入事件

如要擷取網域所有服務的所有登入資訊,請使用下列 GET HTTP 要求,並附上「授權文件」中所述的授權權杖。如要進一步瞭解要求查詢字串和回應屬性,請參閱 API 參考資料。為了方便閱讀,以下範例會換行顯示:

GET https://admin.googleapis.com/admin/reports/v1/activity/users/all
/applications/login?endTime=end date&startTime=start date
&maxResults=maximum number of events returned on a response page

以下範例會取得過去 180 天內,帳戶所有登入事件的報表。maxResults 查詢參數會讓這份報表每頁傳回 25 個結果。

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

下列範例會取得過去 180 天內,客戶所有登入事件的報表。customerId 指定要擷取哪個客戶的報表。

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

依事件名稱擷取 Google Workspace 登入事件

在某些情況下,您可能想擷取特定事件,例如可疑的登入成功事件。如要執行這項操作,請使用下列形式的 GET HTTP 要求:

GET https://admin.googleapis.com/admin/reports/v1/activity/users/all
/applications/login?maxResults=maximum number of events returned on a response page
&eventName=name of the login event
&filters=event parameter relational operator parameter value

以下範例說明如何擷取網域中所有可疑的成功登入:

GET https://admin.googleapis.com/admin/reports/v1/activity/users/all/applications/login?eventName=login_success&filters=is_suspicious==true&maxResults=25