API Báo cáo: Báo cáo về việc sử dụng thực thể
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 thực thể trả về các hoạt động dịch vụ của Google Workspace liên quan đến thực thể
mà người dùng tài khoản của bạn sử dụng. Bạn có thể tuỳ chỉnh và lọc các báo cáo này theo mức sử dụng cụ thể
của bạn. Dữ liệu có sẵn trong 30 ngày qua.
Báo cáo mức sử dụng thực thể chỉ có thể được sử dụng cho các mục đích hợp pháp tại
theo Thoả thuận khách hàng của bạn. Các báo cáo này cũng áp dụng cho
Google Workspace và Education.
Truy xuất hoạt động sử dụng của tất cả thực thể
Hiện tại, loại thực thể duy nhất được API này hỗ trợ là cộng đồng trên Google+. Để truy xuất một
báo cáo về tất cả hoạt động liên quan đến thực thể ứng dụng trong tài khoản của bạn, hãy sử dụng
Yêu cầu HTTP GET
và bao gồm mã thông báo uỷ quyền được mô tả trong
tài liệu uỷ quyền. Cho
dễ đọc hơn, ví dụ sau đây được định dạng với lệnh trả về dòng:
GET https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/all/dates/date
?parameters=applicationParameters
&filters=parameterFilters
&maxResults=maxResults
Giá trị date là ngày sử dụng và dấu thời gian nằm trong
Định dạng ISO 8601, yyyy-mm-dd. Bạn nên
hãy dùng múi giờ trong tài khoản
của bạn cho việc này. Để biết thêm thông tin về tham số chuỗi truy vấn và
các thuộc tính phản hồi, hãy xem API
Tệp đối chiếu. Để biết thông tin về các thông số báo cáo sử dụng thực thể, hãy xem
Tham số sử dụng thực thể
tham khảo.
applicationParameters là danh sách các tham số được phân tách bằng dấu phẩy mà bạn muốn truy xuất.
Mỗi tham số được định dạng là application:parameter_name
, ví dụ:
gplus:community_name
Các thông số có sẵn được ghi lại trong
Tham số sử dụng thực thể
tham khảo. Nếu bạn không chỉ định tham số, hàm sẽ trả về tất cả các tham số.
parameterFilters là danh sách bộ lọc được phân tách bằng dấu phẩy để áp dụng cho kết quả. Một
có định dạng như sau:
application:parameter_name[relational_operator]parameter_value
. Ví dụ:
bộ lọc gplus:num_total_members>100
lọc kết quả để chỉ chứa kết quả
trong đó tham số gplus:num_total_members
có giá trị lớn hơn 100.
maxResults là số lượng kết quả tối đa cần trả về trong một lần tìm nạp. Nếu tổng số
nhiều hơn số kết quả này, phản hồi sẽ bị cắt bớt và
nextPageToken
sẽ được đưa vào (xem
Ví dụ về phản hồi JSON ở bên dưới).
Ví dụ
Ví dụ sau đây tạo một báo cáo chứa tất cả các thông số
cho tất cả các thực thể gplus_communities
.
GET https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/all
/dates/2017-12-11
Ví dụ sau đây sẽ tạo một báo cáo chứa thông số community_name
cho tất cả các thực thể gplus_communities
.
GET https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/all
/dates/2017-12-11?parameters=gplus:community_name
Ví dụ sau đây tạo một báo cáo về community_name
và
num_total_members
cho mỗi thực thể gplus_communities
, được lọc theo
các cộng đồng có hơn 100 thành viên. Để biết ví dụ về phản hồi của API, hãy xem
Ví dụ về phản hồi JSON.
GET https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/all/dates/2017-12-11
?parameters=gplus:community_name,gplus:num_total_members&filters=gplus:num_total_members>100
Truy xuất báo cáo cho một thực thể cụ thể
Để truy xuất báo cáo cho một thực thể cụ thể, hãy sử dụng yêu cầu HTTP GET
sau đây và
bao gồm mã thông báo uỷ quyền được mô tả trong
tài liệu uỷ quyền. Cho
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/gplus_communities/entityKey/dates/date
?parameters=applicationParameters
&filters=parameterFilters
&maxResults=maxResults
entityKey là giá trị nhận dạng thực thể dành riêng cho ứng dụng mà
trực tiếp của thực thể. Xem API
Tài liệu tham khảo để biết thông tin chi tiết về cách lấy entityKey cho thực thể cụ thể mà bạn
quan tâm. Các tham số khác được ghi lại ở trên trong
Truy xuất hoạt động sử dụng của tất cả thực thể.
Để 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ề thông số báo cáo sử dụng thực thể, hãy xem
Tham số sử dụng thực thể
tham khảo.
Ví dụ
Ví dụ sau đây tải báo cáo thực thể cho một thực thể gplus_community
có phần tử
entityKey "1234".
https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/1234/dates/2017-12-11
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 thì phản hồi sẽ trả về một báo cáo. Một số thông số trong phản hồi đã bị
được lược bỏ để dễ đọc.
Ví dụ về phản hồi JSON cho báo cáo thực thể
{
"kind": "reports#usageReports",
"nextPageToken": "NjQ1OTgwODk0MzkxNDAwNjQ0OA",
"usageReports": [
{
"kind": "admin#reports#usageReport",
"date": "2017-12-11",
"entity": {
"type": "OBJECT",
"customerId": "C03az79cb",
"objectType": "GPLUS_COMMUNITY",
"objectId": "1234",
},
"parameters": [
{
"name": "gplus:community_name",
"stringValue": "My Community"
},
{
"name": "gplus:num_total_members",
"intValue": 37
},
{
"name": "gplus:num_7day_active_members",
"intValue": 12
},
{
"name": "gplus:num_30day_active_members",
"intValue": 17
},
]
}
]
}
Ví dụ về phản hồi JSON cho báo cáo thực thể kèm theo cảnh báo
Hệ thống có thể trả về một hoặc nhiều cảnh báo trong phản hồi nếu không thực hiện được yêu cầu. Trong phần này
Ví dụ: không có báo cáo tại thời điểm yêu cầu được tạo.
{
"kind": "reports#usageReports",
"warnings": [
{
"code": "PARTIAL_DATA_AVAILABLE"
"message": "Data for date 2017-12-11 for application gplus is not available right now, please try again after a few hours."
"data": [
{
"key": "date"
"value": "2017-12-11"
}
]
}
],
"usageReports": [],
}
Mỗi mục trong mảng warnings
có các tham số sau:
code
: mã cảnh báo mà máy có thể đọc được
message
: thông báo cảnh báo mà con người có thể đọc được
data
: danh sách các cặp khoá-giá trị cung cấp thông tin cảnh báo chi tiết
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: Entities Usage Report\n\nThe entities usage report returns Google Workspace service activities related to entities\nused by your account's users. These reports can be customized and filtered for specific usage\ninformation. Data is available for the past 30 days.\n\nThe entities usage report may be used only for lawful purposes in\naccordance with your Customer Agreement. These reports also apply to\nGoogle Workspace and Education.\n\nRetrieve all entities usage activities\n--------------------------------------\n\nCurrently, the only entity type supported by this API is Google+ communities. To retrieve a\nreport of all activities related to app entities in your account, use the following\n`GET` HTTP request and include the authorization token described in the\n[authorization documentation](/workspace/admin/reports/v1/guides/authorizing). For\nreadability, the following example is formatted with line returns: \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/all/dates/date\n?parameters=applicationParameters\n&filters=parameterFilters\n&maxResults=maxResults\n```\n\nThe \u003cvar translate=\"no\"\u003edate\u003c/var\u003e value is the date the usage occurred and the timestamp is in the\n[ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601), yyyy-mm-dd. We recommend you\nuse your account's time zone for this. For more information about the query string parameters and\nresponse properties, see the [API\nReference](/workspace/admin/reports/v1/reference/entityUsageReports/get). For information about the entities usage report parameters, see the\n[Entities Usage Parameters\nreference](/workspace/admin/reports/v1/reference/usage-ref-appendix-a/entities).\n\n\u003cvar translate=\"no\"\u003eapplicationParameters\u003c/var\u003e is a comma-separated list of parameters you wish to retrieve.\nEach parameter is formatted as `application:parameter_name`, for example,\n`gplus:community_name`. The available parameters are documented in the\n[Entities Usage Parameters\nreference](/workspace/admin/reports/v1/reference/usage-ref-appendix-a/entities). If no parameters are specified, all are returned.\n\n\u003cvar translate=\"no\"\u003eparameterFilters\u003c/var\u003e is a comma-separated list of filters to apply to the results. Each\nfilter is formatted as\n`application:parameter_name[relational_operator]parameter_value`. For example, the\nfilter `gplus:num_total_members\u003e100` filters the results to contain only results\nwhere the `gplus:num_total_members` parameter has a value greater than 100.\n\n\u003cvar translate=\"no\"\u003emaxResults\u003c/var\u003e is the maximum number of results to return in a single fetch. If the total\nnumber of results is greater than this, the response will be truncated and a\n`nextPageToken` will be included (see the\n[JSON response example](#example_response) below).\n\n### Examples\n\nThe following example gets a report containing all parameters\nfor all `gplus_communities` entities. \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/all\n/dates/2017-12-11\n```\n\nThe following example gets a report containing the `community_name` parameter\nfor all `gplus_communities` entities. \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/all\n/dates/2017-12-11?parameters=gplus:community_name\n```\n\nThe following example gets a report of `community_name` and\n`num_total_members` for each `gplus_communities` entity, filtered by\ncommunities with more than 100 members. For an example of an API response, see the\n[JSON response example](#example_response). \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/all/dates/2017-12-11\n?parameters=gplus:community_name,gplus:num_total_members&filters=gplus:num_total_members\u003e100\n```\n\nRetrieve a report for a specific entity\n---------------------------------------\n\nTo retrieve a report for a specific entity, use the following `GET` HTTP request and\ninclude the authorization token described in the\n[authorization documentation](/workspace/admin/reports/v1/guides/authorizing). For\nreadability, the following example is formatted with line returns. \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/gplus_communities/entityKey/dates/date\n?parameters=applicationParameters\n&filters=parameterFilters\n&maxResults=maxResults\n```\n\nThe \u003cvar translate=\"no\"\u003eentityKey\u003c/var\u003e is an entity identifier which is specific to the application where the\nentity lives. See the [API\nReference](/workspace/admin/reports/v1/reference/userUsageReport/get) for details on how to obtain the \u003cvar translate=\"no\"\u003eentityKey\u003c/var\u003e for the particular entity you\nare interested in. The other parameters are documented above under\n[Retrieve all entities usage activities](#get_all_entities_usage).\n\nFor more information about the query string parameters and response properties, see the [API Reference](/workspace/admin/reports/v1/reference/userUsageReport/get). For information\nabout the entities usage report parameters, see the\n[Entities Usage Parameters\nreference](/workspace/admin/reports/v1/reference/usage-ref-appendix-a/users).\n\n### Examples\n\nThe following example gets the entity report for a `gplus_community` entity with the\n\u003cvar translate=\"no\"\u003eentityKey\u003c/var\u003e \"1234\". \n\n```\nhttps://admin.googleapis.com/admin/reports/v1/usage/gplus_communities/1234/dates/2017-12-11\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\nthe status code, the response returns a report. Some of the parameters in the response have been\nomitted for readability.\n\n#### Example JSON response for entities report\n\n```carbon\n{\n \"kind\": \"reports#usageReports\",\n \"nextPageToken\": \"NjQ1OTgwODk0MzkxNDAwNjQ0OA\",\n \"usageReports\": [\n {\n \"kind\": \"admin#reports#usageReport\",\n \"date\": \"2017-12-11\",\n \"entity\": {\n \"type\": \"OBJECT\",\n \"customerId\": \"C03az79cb\",\n \"objectType\": \"GPLUS_COMMUNITY\",\n \"objectId\": \"1234\",\n },\n \"parameters\": [\n {\n \"name\": \"gplus:community_name\",\n \"stringValue\": \"My Community\"\n },\n {\n \"name\": \"gplus:num_total_members\",\n \"intValue\": 37\n },\n {\n \"name\": \"gplus:num_7day_active_members\",\n \"intValue\": 12\n },\n {\n \"name\": \"gplus:num_30day_active_members\",\n \"intValue\": 17\n },\n ]\n }\n ]\n}\n```\n\n#### Example JSON response for entities report with warnings\n\nOne or more warnings may be returned in the response if the request cannot be fulfilled. In this example, the report is not available at the time the request is made. \n\n```scdoc\n{\n \"kind\": \"reports#usageReports\",\n \"warnings\": [\n {\n \"code\": \"PARTIAL_DATA_AVAILABLE\"\n \"message\": \"Data for date 2017-12-11 for application gplus is not available right now, please try again after a few hours.\"\n \"data\": [\n {\n \"key\": \"date\"\n \"value\": \"2017-12-11\"\n }\n ]\n }\n ],\n \"usageReports\": [],\n}\n```\nEach entry in the `warnings` array has the following parameters:\n\n- `code`: machine-readable warning code\n- `message`: human-readable warning message\n- `data`: list of key-value pairs which give detailed warning information"]]