API Báo cáo: Báo cáo mức sử dụng của người dùng
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Báo cáo mức sử dụng của người dùng trả về thông tin về mức sử dụng dịch vụ Google Workspace của một người dùng cụ thể trong miền của bạn.
Bạn có thể tuỳ chỉnh và lọc các báo cáo này để theo dõi thông tin cụ thể về mức sử dụng.
Khoảng thời gian mặc định và tối đa cho mỗi báo cáo là 450 ngày qua.
Những báo cáo về việc sử dụng của người dùng này chỉ có thể được sử dụng cho các mục đích hợp pháp theo Thoả thuận khách hàng của bạn. Ngoài ra, các báo cáo này áp dụng cho Google Workspace và Education.
Truy xuất mọi hoạt động sử dụng của người dùng
Để truy xuất báo cáo về tất cả hoạt động của người dùng trong tài khoản của bạn, hãy sử dụng yêu cầu HTTP GET
sau đây và thêm mã thông báo uỷ quyền được mô tả trong tài liệu về uỷ quyền. Để dễ đọc, ví dụ sau đây được định dạng bằng lệnh trả về dòng:
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
Giá trị dates
là ngày bắt đầu sử dụng và dấu thời gian ở định dạng ISO 8601, yyyy-mm-dd. Để biết thêm thông tin về các tham số chuỗi truy vấn và thuộc tính phản hồi, hãy xem Tài liệu tham khảo API. Để biết thông tin về các thông số trong báo cáo sử dụng của người dùng, hãy xem tài liệu tham khảo về Thông số sử dụng của người dùng.
Ví dụ sau đây sẽ tạo một báo cáo về tất cả hoạt động của người dùng trong tài khoản.
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all
/dates/2013-03-03?maxResults=2
Ví dụ sau đây tạo báo cáo về tất cả hoạt động của người dùng cho một tài khoản khách hàng cụ thể.
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all
/dates/2013-03-03?customerId=C03az79cb
Ví dụ sau đây sẽ tạo một báo cáo về dấu thời gian đăng nhập gần đây nhất của người dùng trong tài khoản. Để xem ví dụ về phản hồi API, hãy xem ví dụ về phản hồi JSON.
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03
?parameters=accounts:last_login_time&maxResults=2
Ví dụ sau đây tạo báo cáo về dấu thời gian đăng nhập gần đây nhất của người dùng trong tài khoản, lọc theo người dùng đã đăng nhập sau một khoảng thời gian cụ thể. Để xem ví dụ về phản hồi API, hãy xem ví dụ về phản hồi 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"
Ví dụ sau đây sẽ tạo báo cáo về dấu thời gian đăng nhập gần đây nhất và trạng thái tạm ngưng của người dùng trong tài khoản. Để xem ví dụ về phản hồi API, hãy xem ví dụ về phản hồi JSON.
GET https://admin.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-03-03
?parameters=accounts:last_login_time,accounts:is_disabled"
Truy xuất hoạt động sử dụng của một người dùng cụ thể
Để truy xuất báo cáo về hoạt động của một người dùng cụ thể trong tài khoản của bạn, hãy sử dụng yêu cầu HTTP GET
sau đây và thêm mã thông báo uỷ quyền được mô tả trong tài liệu về việc uỷ quyền. Để dễ đọc, ví dụ sau được định dạng bằng lệnh trả về dòng.
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
có thể là địa chỉ email chính của người dùng trong báo cáo hoặc profileId
Google Workspace của riêng người dùng. Giá trị dates
là ngày bắt đầu sử dụng và dấu thời gian ở định dạng ISO 8601, yyyy-mm-dd. Để biết thêm thông tin về các tham số chuỗi truy vấn và thuộc tính phản hồi, hãy xem Tài liệu tham khảo API. Để biết thông tin về các thông số trong báo cáo sử dụng của người dùng, hãy xem tài liệu tham khảo về Thông số sử dụng của người dùng.
Ví dụ sau đây lấy báo cáo sử dụng cho john@example.com.
https://admin.googleapis.com/admin/reports/v1/usage/users/john@example.com/dates/2013-03-03
Phản hồi JSON mẫu cho báo cáo về việc sử dụng
Khi phản hồi thành công, hệ thống sẽ trả về mã trạng thái HTTP 200. Cùng với mã trạng thái, phản hồi sẽ trả về một báo cáo.
Phản hồi JSON cho báo cáo của người dùng
{
"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"
}
]
}
]
}
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-29 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-29 UTC."],[],[],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```"]]