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