使用者使用情形報告會傳回網域中特定使用者的 Google Workspace 服務使用情形資訊。 您可以針對特定使用資訊自訂及篩選這些報表。每份報表的預設時間範圍和最長的時間範圍為最近 450 天。
這類使用者使用情形報表只能依《客戶協議》的合法用途使用。此外,這些報告也適用於 Google Workspace 和 Google Workspace。
擷取所有使用者使用活動
如要擷取帳戶中所有使用者活動的報表,請使用下列 GET
HTTP 要求,並加入授權說明文件中所述的授權權杖。為了方便閱讀,以下範例採用換行格式:
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/yyyy-mm-dd date ?parameters=application: user usage parameter,... &filters=application: user usage parameter relational operator usage parameter's value,... &maxResults=number of events listed on each page of the report
dates
值代表使用情況發生的日期,且時間戳記採用 ISO 8601 格式 (yyyy-mm-dd)。如要進一步瞭解查詢字串參數和回應屬性,請參閱 API 參考資料。如需瞭解使用者使用情形報表參數,請參閱使用者使用情形參數參考資料。
以下範例會取得該帳戶的所有使用者活動報表。
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all /dates/2013-03-03?maxResults=2
以下範例會取得特定客戶帳戶的所有使用者活動報表。
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all /dates/2013-03-03?customerId=C03az79cb
以下範例會取得帳戶中使用者的上次登入時間戳記。如需 API 回應範例,請參閱 JSON 回應範例。
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03 ?parameters=accounts:last_login_time&maxResults=2
以下範例將為帳戶中的使用者上次登入時間戳記產生報表,並依在特定時間後登入的使用者篩選資料。如需 API 回應範例,請參閱 JSON 回應範例。
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03 ?parameters=accounts:last_login_time&filters=accounts:last_login_time >2010-10-28T10:26:35.000Z"
以下範例會取得帳戶中使用者上次登入時間戳記和停權狀態的報表。如需 API 回應範例,請參閱 JSON 回應範例。
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03 ?parameters=accounts:last_login_time,accounts:is_disabled"
擷取特定使用者的使用活動
如要擷取帳戶中特定使用者活動的報表,請使用下列 GET
HTTP 要求,並加入授權說明文件中所述的授權權杖。為了方便閱讀,以下範例會採用換行格式。
GET https://admin.googleapis.com/admin/reports/v1/usage/users/userKey/dates/yyyy-mm-dd date ?parameters=application: user usage parameter,... &filters=application: user usage parameter relational operator usage parameter's value,... &maxResults=number of events listed on each page of the report
userKey
可以是報表中的使用者的主要電子郵件地址,也可以是使用者專屬的 Google Workspace profileId
。dates
值代表使用情況發生的日期,且時間戳記採用 ISO 8601 格式 (yyyy-mm-dd)。如要進一步瞭解查詢字串參數和回應屬性,請參閱 API 參考資料。如需瞭解使用者使用情形報表參數,請參閱使用者使用情形參數參考資料。
以下範例會取得 john@example.com 的使用情形報告。
https://admin.googleapis.com/admin/reports/v1/usage/users/john@example.com/dates/2013-03-03
用量報表範例 JSON 回應
成功的回應會傳回 HTTP 200 狀態碼。回應會傳回狀態碼,以及傳回報告。
使用者報表的 JSON 回應
{ "kind": "reports#usageReports", "warnings": [ { "code": warning machine-readable code, "message": warning human-readable message, "data": [ { "key": key for key-value pair that gives detailed warning information, "value": value for key-value pair giving detailed warning information } ] } ], "nextPageToken": "N:NNN:NNN:N:C03az79cb", "usageReports": [ { "kind": "usageReport", "date": "2013-03-03", "entity": { "type": "USER", "customerId": "C03az79cb", "userEmail": "liz@example.com", "profileId": "user's unique Google Workspace ID" }, "parameters": [ { "name": "accounts:is_disabled", "boolValue": false }, { "name": "accounts:disabled_reason", "stringValue": "reason description" }, { "name": "accounts:first_name", "stringValue": "Liz" }, { "name": "accounts:is_2sv_enforced", "boolValue": false }, { "name": "accounts:is_2sv_enrolled", "boolValue": false }, { "name": "accounts:last_name", "stringValue": "Smith" }, { "name": "accounts:creation_time", "datetimeValue": "2010-10-28T10:26:35.000Z" }, { "name": "accounts:last_login_time", "datetimeValue": "1970-01-01T00:00:00.000Z" }, { "name": "accounts:last_sso_time", "datetimeValue": "1970-01-01T00:00:00.000Z" } ] } ] }