Chrome Management Reports API 程式碼範例
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
前往 Chrome Management Reports API:
API 功能總覽
下列所有要求都會使用下列變數:
$TOKEN
- OAuth 2 權杖
$CUSTOMER
- 客戶 ID 或常值 my_customer
$ORG_UNIT_ID
- 要產生要求的獨立機構單位 ID。
計算日期範圍內正在使用的 Chrome 版本數量
如要查看在指定時間範圍內使用的 Chrome 版本,
在 filter
參數中使用 last_active_date
值。您可以控制
使用 pageSize
和 pageToken
參數的結果分頁。
要求
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:countChromeVersions?filter=last_active_date<2020-11-06+AND+last_active_date>2020-11-04"
回應
{
"browserVersions": [
{
"count": "1",
"version": "85.0.4183.83",
"system": "SYSTEM_MAC",
"channel": "STABLE"
},
{
"count": "1",
"version": "85.0.4183.102",
"system": "SYSTEM_WINDOWS",
"channel": "STABLE"
},
{
"count": "13697",
"version": "71.0.3578.96",
"system": "SYSTEM_MAC",
"channel": "STABLE"
},
{
"count": "1",
"version": "87.0.4280.40",
"system": "SYSTEM_MAC",
"channel": "BETA"
},
{
"count": "1",
"version": "88.0.4314.0",
"system": "SYSTEM_MAC",
"channel": "CANARY"
},
{
"count": "1718"
},
],
"totalSize": 5
}
計算具有多種權限的應用程式安裝量分佈情形
如何查看已安裝特定應用程式的裝置數量
請使用 number_of_permissions
值中的
filter
參數。您可以使用
pageSize
和 pageToken
參數。
如需更多篩選器參數,請前往
reference:
要求
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:countInstalledApps?filter=number_of_permissions>6"
回應
{
"totalSize": 1,
"installedApps": [
{
"browserDeviceCount": "2",
"appSource": "CHROME_WEBSTORE",
"displayName": "Secure Shell App",
"description": "Terminal emulator and SSH and SFTP client.",
"appType": "APP",
"appInstallType": "ADMIN",
"appId": "pnhechapfaindjhompbnflcldabbghjo",
"homepageUri": "https://chrome.google.com/webstore/detail/pnhechapfaindjhompbnflcldabbghjo",
"permissions": [
"clipboardRead",
"clipboardWrite",
"crashReportPrivate",
"idle",
"metricsPrivate",
"notifications",
"storage",
"unlimitedStorage"
]
},
]
}
已安裝應用程式的裝置數
上例顯示有 2 部裝置已安裝的應用程式。
您可以查看已安裝這個應用程式的裝置,使用
findInstalledAppDevices
自訂方法。
您可以使用 pageSize
和 pageToken
控制結果的分頁
參數。
要求
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:findInstalledAppDevices?appType=app&appId=pnhechapfaindjhompbnflcldabbghjo"
回應
{
"totalSize": 2,
"devices": [
{
"machine": "MACHINEA-A",
"deviceId": "b472473e-fe50-4c6e-9ac3-03fe0d0753ce"
},
{
"machine": "MACHINE-B",
"deviceId": "a5f49e54-b07b-409f-bc5c-aaf27c483249"
}
]
}
後續追蹤要求
根據上述範例傳回的裝置 ID,您可以取得更多
方法是使用
適用於 Chrome 瀏覽器的 Admin SDK Directory API。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eUse the Chrome Management Reports API to retrieve data on Chrome browser and app usage within your organization.\u003c/p\u003e\n"],["\u003cp\u003eThe API allows you to count Chrome versions active within a specified date range, filter by criteria like the number of app permissions, and identify devices with specific apps installed.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the \u003ccode\u003ecountChromeVersions\u003c/code\u003e, \u003ccode\u003ecountInstalledApps\u003c/code\u003e, and \u003ccode\u003efindInstalledAppDevices\u003c/code\u003e methods for gathering data insights.\u003c/p\u003e\n"],["\u003cp\u003eDetailed information about specific devices can be retrieved through the Admin SDK Directory API using the device ID.\u003c/p\u003e\n"]]],[],null,["# Code Samples for the Chrome Management Reports API\n\nVisit [Chrome Management Reports API](/chrome/management/guides/reports_api) for\nan overview of API features.\n\nAll the requests shown below use the following variables:\n\n- `$TOKEN` - OAuth 2 token\n- `$CUSTOMER` - ID of the customer or literal `my_customer`\n- `$ORG_UNIT_ID` - ID of a particluar org unit for which you want to generate a request.\n\nCount Chrome versions active in date range\n------------------------------------------\n\nTo view which Chrome versions were active over a given range of time,\nuse the `last_active_date` value in the `filter` parameter. You can control\npagination of the results using the `pageSize` and `pageToken` parameters.\n\n#### Request\n\n curl -X GET \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:countChromeVersions?filter=last_active_date\u003c2020-11-06+AND+last_active_date\u003e2020-11-04\"\n\n#### Response\n\n {\n \"browserVersions\": [\n {\n \"count\": \"1\",\n \"version\": \"85.0.4183.83\",\n \"system\": \"SYSTEM_MAC\",\n \"channel\": \"STABLE\"\n },\n {\n \"count\": \"1\",\n \"version\": \"85.0.4183.102\",\n \"system\": \"SYSTEM_WINDOWS\",\n \"channel\": \"STABLE\"\n },\n {\n \"count\": \"13697\",\n \"version\": \"71.0.3578.96\",\n \"system\": \"SYSTEM_MAC\",\n \"channel\": \"STABLE\"\n },\n {\n \"count\": \"1\",\n \"version\": \"87.0.4280.40\",\n \"system\": \"SYSTEM_MAC\",\n \"channel\": \"BETA\"\n },\n {\n \"count\": \"1\",\n \"version\": \"88.0.4314.0\",\n \"system\": \"SYSTEM_MAC\",\n \"channel\": \"CANARY\"\n },\n {\n \"count\": \"1718\"\n },\n ],\n \"totalSize\": 5\n }\n\nCount distribution of app installations with a number of permissions\n--------------------------------------------------------------------\n\nTo view the number of devices that have installed a particular app with a given\nnumber of permissions, use the `number_of_permissions` value in the\n`filter` parameter. You can control pagination of the results using the\n`pageSize` and `pageToken` parameters.\n\nFor more filter parameters, visit the\n[reference](/chrome/management/reference/rest/v1/customers.reports/countInstalledApps).\n\n#### Request\n\n curl -X GET \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:countInstalledApps?filter=number_of_permissions\u003e6\"\n\n#### Response\n\n {\n \"totalSize\": 1,\n \"installedApps\": [\n {\n \"browserDeviceCount\": \"2\",\n \"appSource\": \"CHROME_WEBSTORE\",\n \"displayName\": \"Secure Shell App\",\n \"description\": \"Terminal emulator and SSH and SFTP client.\",\n \"appType\": \"APP\",\n \"appInstallType\": \"ADMIN\",\n \"appId\": \"pnhechapfaindjhompbnflcldabbghjo\",\n \"homepageUri\": \"https://chrome.google.com/webstore/detail/pnhechapfaindjhompbnflcldabbghjo\",\n \"permissions\": [\n \"clipboardRead\",\n \"clipboardWrite\",\n \"crashReportPrivate\",\n \"idle\",\n \"metricsPrivate\",\n \"notifications\",\n \"storage\",\n \"unlimitedStorage\"\n ]\n },\n ]\n }\n\nCount devices that have an installed app\n----------------------------------------\n\nThe previous example showed an app that has been installed on 2 devices.\nTo view the devices that have installed this app, you can use the\n`findInstalledAppDevices` custom method.\nYou can control pagination of the results using the `pageSize` and `pageToken`\nparameters.\n\n#### Request\n\n curl -X GET \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:findInstalledAppDevices?appType=app&appId=pnhechapfaindjhompbnflcldabbghjo\"\n\n#### Response\n\n {\n \"totalSize\": 2,\n \"devices\": [\n {\n \"machine\": \"MACHINEA-A\",\n \"deviceId\": \"b472473e-fe50-4c6e-9ac3-03fe0d0753ce\"\n },\n {\n \"machine\": \"MACHINE-B\",\n \"deviceId\": \"a5f49e54-b07b-409f-bc5c-aaf27c483249\"\n }\n ]\n }\n\n### Follow-up request\n\nGiven the device ID returned in the previous example, you can get more\ninformation about the device that has installed the app by using the\n[Admin SDK Directory API for Chrome Browsers](/admin-sdk/directory/v1/guides/manage-chrome-browsers)."]]