Reports API: รายงานการใช้งานของผู้ใช้
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
รายงานการใช้งานของผู้ใช้จะแสดงข้อมูลการใช้บริการ Google Workspace ของผู้ใช้บางรายในโดเมนของคุณ
รายงานเหล่านี้สามารถปรับแต่งและกรองข้อมูลสำหรับการใช้งานที่เฉพาะเจาะจง
ระยะเวลาเริ่มต้นและระยะเวลาสูงสุดสำหรับแต่ละรายงานคือ 450 วันที่ผ่านมา
รายงานการใช้งานของผู้ใช้เหล่านี้สามารถใช้เพื่อวัตถุประสงค์ที่ชอบด้วยกฎหมายตามข้อตกลงของลูกค้าของคุณเท่านั้น นอกจากนี้ รายงานเหล่านี้ยังใช้ได้กับ Google Workspace และ Education
ดึงข้อมูลกิจกรรมการใช้งานของผู้ใช้ทั้งหมด
หากต้องการเรียกดูรายงานกิจกรรมของผู้ใช้ทั้งหมดในบัญชี ให้ใช้คำขอ HTTP GET
ต่อไปนี้และรวมโทเค็นการให้สิทธิ์ที่อธิบายไว้ในเอกสารการให้สิทธิ์ ตัวอย่างต่อไปนี้จัดรูปแบบด้วยการขึ้นบรรทัดใหม่เพื่อให้อ่านง่ายขึ้น
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 ปปปป-ดด-วว ดูข้อมูลเพิ่มเติมเกี่ยวกับพารามิเตอร์สตริงการค้นหาและพร็อพเพอร์ตี้การตอบกลับได้ที่ข้อมูลอ้างอิง 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"
ดึงข้อมูลกิจกรรมการใช้งานของผู้ใช้ที่ต้องการ
หากต้องการเรียกรายงานกิจกรรมของผู้ใช้ที่เฉพาะเจาะจงในบัญชีของคุณ ให้ใช้คำขอ HTTP GET
ต่อไปนี้และรวมโทเค็นการให้สิทธิ์ที่อธิบายไว้ในเอกสารการให้สิทธิ์ ตัวอย่างต่อไปนี้จัดรูปแบบด้วยการขึ้นบรรทัดใหม่เพื่อให้อ่านง่ายขึ้น
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 ปปปป-ดด-วว ดูข้อมูลเพิ่มเติมเกี่ยวกับพารามิเตอร์สตริงการค้นหาและพร็อพเพอร์ตี้การตอบกลับได้ที่ข้อมูลอ้างอิง 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 Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 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```"]]