Reports API: รายงานการใช้งานของลูกค้า
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
รายงานการใช้งานของลูกค้า
รวบรวมข้อมูลการใช้บริการ Google Workspace ของผู้ใช้ทุกคนทั่วทั้งโดเมน
รายงานการใช้งานของผู้ใช้จะแสดงข้อมูลการใช้บริการ Google Workspace ในบัญชีของคุณ
ข้อมูลการใช้งานนี้จะจัดเรียงตามประเภทของแอปพลิเคชัน ซึ่งประกอบด้วยพารามิเตอร์เฉพาะสำหรับแอปพลิเคชันนั้นๆ
ระยะเวลาเริ่มต้นและระยะเวลาสูงสุดสำหรับแต่ละรายงานคือ 450 วันที่ผ่านมา
รายงานการใช้งานเหล่านี้จะใช้เพื่อวัตถุประสงค์ที่ชอบด้วยกฎหมายตามข้อตกลงของลูกค้าเท่านั้น นอกจากนี้
จะมีผลกับ Google Workspace และ Education
ดึงข้อมูลรายงานการใช้งานของลูกค้า
หากต้องการดึงรายงานกิจกรรมในบัญชี ให้ใช้คำขอ HTTP GET
ต่อไปนี้และรวมโทเค็นการให้สิทธิ์
ตามที่อธิบายไว้ในเอกสารการให้สิทธิ์ เพื่อให้อ่านง่ายขึ้น
ตัวอย่างต่อไปนี้มีการจัดรูปแบบโดยมีการขึ้นบรรทัดใหม่
GET https://admin.googleapis.com/admin/reports/v1/usage/dates/yyyy-mm-dd date
?parameters=app name: usage parameter,...
&customerId=the customer's ID
&maxResults=number of events listed on each page of the report
ค่า dates
คือวันที่ที่เกิดการใช้งานและการประทับเวลาอยู่ในรูปแบบ ISO 8601 ปปปป-ดด-วว เราขอแนะนำให้คุณใช้เขตเวลาของบัญชีสำหรับการดำเนินการนี้ ดูข้อมูลเพิ่มเติมเกี่ยวกับสตริงการค้นหาและพร็อพเพอร์ตี้การตอบกลับของคำขอได้ที่เอกสารอ้างอิง API และข้อมูลอ้างอิงพารามิเตอร์รายงานการใช้งานของลูกค้า
ตัวอย่างต่อไปนี้จะเป็นรายงานที่มียอดรวมของการเข้าสู่ระบบที่สำเร็จทั้งหมดในบัญชีของคุณในช่วง 30 วันที่ผ่านมาและรายชื่อ
ของแอปพลิเคชันที่ได้รับสิทธิ์พร้อมจำนวนการให้สิทธิ์ผู้ใช้ต่อแอปพลิเคชัน เริ่มตั้งแต่วันที่ 03-03-2013 maxResults
สตริงการค้นหาแสดงให้เห็นว่ารายงานนี้แสดง 2 เหตุการณ์ต่อหน้ารายงาน:
GET https://admin.googleapis.com/admin/reports/v1/usage/dates/2013-03-03
?parameters=accounts:num_30day_logins%2Caccounts:authorized_apps&maxResults=2
การตอบกลับ 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": "CUSTOMER",
"customerId": "C03az79cb"
},
"parameters": [
{
"name": "accounts:num_1day_logins",
"intValue": "1"
},
{
"name": "accounts:num_30day_logins",
"intValue": "1"
},
{
"name": "accounts:num_7day_logins",
"intValue": "1"
},
{
"name": "accounts:num_disabled_accounts",
"intValue": "5"
},
{
"name": "accounts:authorized_apps",
"msgValue": [
{
"client_id": "1234.apps.googleusercontent.com",
"client_name": "www.example.com",
"num_users": 2
},
{
"client_id": "4567.apps.googleusercontent.com",
"client_name": "Example",
"num_users": 1
},
...
]
}
]
}
]
}
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[],[],null,["# Reports API: Customers Usage Report\n\nThe Customers usage report\naggregates Google Workspace service usage information, for all users, across an entire domain.\nThe user usage report returns Google Workspace service usage information across your account.\nThis usage information is organized by application type which is composed of parameters specific to that application.\nThe default and maximum time period for each report is the last 450 days.\n\nThese usage report may be used only for lawful purposes in accordance with your Customer Agreement. Also, these\nreports apply to Google Workspace and Education.\n\nRetrieve a customer usage report\n--------------------------------\n\nTo retrieve report of your account activities use the following `GET` HTTP request and include the authorization token\ndescribed in the [authorization documentation](/workspace/admin/reports/v1/guides/authorizing). For readability,\nthe following example is formatted with line returns: \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/dates/yyyy-mm-dd date\n?parameters=app name: usage parameter,...\n&customerId=the customer's ID\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. We recommend you use your account's time zone for this. For more information about the request's query strings and response properties, see the [API Reference](/workspace/admin/reports/v1/reference/customerUsageReports/get) and the [customer usage report parameters reference](/workspace/admin/reports/v1/reference/usage-ref-appendix-a/customers).\n\nThe following example gets a report with the total of all successful logins to your account in the past 30 days and a list\nof authorized applications, with the number of user authorizations per application, starting 2013-03-03. The `maxResults`\nquery string shows this report returns two events per report page: \n\n```\nGET https://admin.googleapis.com/admin/reports/v1/usage/dates/2013-03-03\n?parameters=accounts:num_30day_logins%2Caccounts:authorized_apps&maxResults=2\n```\n\n#### JSON response for customer usage 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\": \"CUSTOMER\",\n \"customerId\": \"C03az79cb\"\n },\n \"parameters\": [\n {\n \"name\": \"accounts:num_1day_logins\",\n \"intValue\": \"1\"\n },\n {\n \"name\": \"accounts:num_30day_logins\",\n \"intValue\": \"1\"\n },\n {\n \"name\": \"accounts:num_7day_logins\",\n \"intValue\": \"1\"\n },\n {\n \"name\": \"accounts:num_disabled_accounts\",\n \"intValue\": \"5\"\n },\n {\n \"name\": \"accounts:authorized_apps\",\n \"msgValue\": [\n {\n \"client_id\": \"1234.apps.googleusercontent.com\",\n \"client_name\": \"www.example.com\",\n \"num_users\": 2\n },\n {\n \"client_id\": \"4567.apps.googleusercontent.com\",\n \"client_name\": \"Example\",\n \"num_users\": 1\n },\n ...\n ]\n }\n ]\n }\n ]\n}\n```"]]