Reports API:用户使用情况报告
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
用户使用情况报告会返回您网域中特定用户的 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"
}
]
}
]
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[],[],null,["# Reports API: Users Usage Report\n\nThe user usage report returns Google Workspace service usage information for a particular user in your domain.\nThese reports can be customized and filtered for specific usage information.\nThe default and maximum time period for each report is the last 450 days.\n\nThese user usage report may be used only for lawful purposes in accordance with your Customer Agreement. And, these reports apply to Google Workspace and Education.\n\nRetrieve all user usage activities\n----------------------------------\n\nTo retrieve a report of all user activities in your account use the following `GET` HTTP request and include the authorization token described in the [authorization documentation](/workspace/admin/reports/v1/guides/authorizing). For readability, the following example is formatted with line returns: \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/yyyy-mm-dd date\n?parameters=application: user usage parameter,...\n&filters=application: user usage parameter relational operator usage parameter's value,...\n&maxResults=number of events listed on each page of the report\n```\n\nThe `dates` value is the date the usage occurred and the timestamp is in the [ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601), yyyy-mm-dd. For more information about the query string parameters and response properties, see the [API Reference](/workspace/admin/reports/v1/reference/userUsageReport/get). For information about the user usage report parameters, see the [User Usage Parameters reference](/workspace/admin/reports/v1/reference/usage-ref-appendix-a/users).\n\nThe following example gets a report on all user activities for the account. \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/users/all\n/dates/2013-03-03?maxResults=2\n```\n\nThe following example gets a report on all user activities for a specific customer account. \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/users/all\n/dates/2013-03-03?customerId=C03az79cb\n```\n\nThe following example gets a report on the last login timestamps of the users in the account. For an example of an API response, see the [JSON response example](#example_response). \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03\n?parameters=accounts:last_login_time&maxResults=2\n```\n\nThe following example gets a report on the last login timestamps of the users in the account, filtered by users who logged in after a specific time. For an example of an API response, see the [JSON response example](#example_response). \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03\n?parameters=accounts:last_login_time&filters=accounts:last_login_time\n\u003e2010-10-28T10:26:35.000Z\"\n```\n\nThe following example gets a report on the last login timestamps and suspended status of the users in the account. For an example of an API response, see the [JSON response example](#example_response). \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03\n?parameters=accounts:last_login_time,accounts:is_disabled\"\n```\n\nRetrieve a specific user's usage activities\n-------------------------------------------\n\nTo retrieve a report of a specific user's activities in your account use the following `GET` HTTP request and include the authorization token described in the [authorization documentation](/workspace/admin/reports/v1/guides/authorizing). For readability, the following example is formatted with line returns. \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/users/userKey/dates/yyyy-mm-dd date\n?parameters=application: user usage parameter,...\n&filters=application: user usage parameter relational operator usage parameter's value,...\n&maxResults=number of events listed on each page of the report\n```\n\nThe `userKey` can be either the primary email address of the user in the report or the user's unique Google Workspace `profileId`. The `dates` value is the date the usage occurred and the timestamp is in the [ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601), yyyy-mm-dd. For more information about the query string parameters and response properties, see the [API Reference](/workspace/admin/reports/v1/reference/userUsageReport/get). For information about the user usage report parameters, see the [User Usage Parameters reference](/workspace/admin/reports/v1/reference/usage-ref-appendix-a/users).\n\nThe following example gets the usage report for john@example.com. \n\n```\nhttps://admin.googleapis.com/admin/reports/v1/usage/users/john@example.com/dates/2013-03-03\n```\n\nUsage report example JSON response\n----------------------------------\n\nA successful response returns an [HTTP 200 status code](http://wikipedia.org/wiki/List_of_HTTP_status_codes). Along with the status code, the response returns a report.\n\n#### JSON response for user report\n\n```carbon\n{\n \"kind\": \"reports#usageReports\",\n \"warnings\": [\n {\n \"code\": warning machine-readable code,\n \"message\": warning human-readable message,\n \"data\": [\n {\n \"key\": key for key-value pair that gives detailed warning information,\n \"value\": value for key-value pair giving detailed warning information\n }\n ]\n }\n ],\n \"nextPageToken\": \"N:NNN:NNN:N:C03az79cb\",\n \"usageReports\": [\n{\n \"kind\": \"usageReport\",\n \"date\": \"2013-03-03\",\n \"entity\": {\n \"type\": \"USER\",\n \"customerId\": \"C03az79cb\",\n \"userEmail\": \"liz@example.com\",\n \"profileId\": \"user's unique Google Workspace ID\"\n },\n \"parameters\": [\n {\n \"name\": \"accounts:is_disabled\",\n \"boolValue\": false\n },\n {\n \"name\": \"accounts:disabled_reason\",\n \"stringValue\": \"reason description\"\n },\n {\n \"name\": \"accounts:first_name\",\n \"stringValue\": \"Liz\"\n },\n {\n \"name\": \"accounts:is_2sv_enforced\",\n \"boolValue\": false\n },\n {\n \"name\": \"accounts:is_2sv_enrolled\",\n \"boolValue\": false\n },\n {\n \"name\": \"accounts:last_name\",\n \"stringValue\": \"Smith\"\n },\n {\n \"name\": \"accounts:creation_time\",\n \"datetimeValue\": \"2010-10-28T10:26:35.000Z\"\n },\n {\n \"name\": \"accounts:last_login_time\",\n \"datetimeValue\": \"1970-01-01T00:00:00.000Z\"\n },\n {\n \"name\": \"accounts:last_sso_time\",\n \"datetimeValue\": \"1970-01-01T00:00:00.000Z\"\n }\n ]\n }\n ]\n}\n```"]]