Contoh Kode untuk Chrome Management Reports API
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Buka Chrome Management Reports API untuk
ringkasan fitur API.
Semua permintaan yang ditampilkan di bawah menggunakan variabel berikut:
$TOKEN
- Token OAuth 2
$CUSTOMER
- ID pelanggan atau my_customer
literal
$ORG_UNIT_ID
- ID unit org tertentu yang ingin Anda buat permintaannya.
Menghitung versi Chrome yang aktif dalam rentang tanggal
Untuk melihat versi Chrome mana yang aktif selama rentang waktu tertentu,
gunakan nilai last_active_date
dalam parameter filter
. Anda dapat mengontrol
penomoran halaman hasil menggunakan parameter pageSize
dan pageToken
.
Permintaan
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"
Respons
{
"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
}
Menghitung distribusi penginstalan aplikasi dengan sejumlah izin
Untuk melihat jumlah perangkat yang telah menginstal aplikasi tertentu dengan
jumlah izin, gunakan nilai number_of_permissions
di kolom
Parameter filter
. Anda dapat mengontrol penomoran halaman pada hasil menggunakan
Parameter pageSize
dan pageToken
.
Untuk parameter filter lainnya, buka
referensi ini.
Permintaan
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:countInstalledApps?filter=number_of_permissions>6"
Respons
{
"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"
]
},
]
}
Menghitung perangkat yang telah menginstal aplikasi
Contoh sebelumnya menampilkan aplikasi yang telah diinstal di 2 perangkat.
Untuk melihat perangkat yang telah menginstal aplikasi ini, Anda dapat menggunakan
Metode kustom findInstalledAppDevices
.
Anda dapat mengontrol penomoran halaman pada hasil menggunakan pageSize
dan pageToken
parameter.
Permintaan
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:findInstalledAppDevices?appType=app&appId=pnhechapfaindjhompbnflcldabbghjo"
Respons
{
"totalSize": 2,
"devices": [
{
"machine": "MACHINEA-A",
"deviceId": "b472473e-fe50-4c6e-9ac3-03fe0d0753ce"
},
{
"machine": "MACHINE-B",
"deviceId": "a5f49e54-b07b-409f-bc5c-aaf27c483249"
}
]
}
Permintaan tindak lanjut
Dengan ID perangkat yang ditampilkan di contoh sebelumnya, Anda bisa mendapatkan
tentang perangkat yang telah menginstal aplikasi dengan menggunakan
Admin SDK Directory API untuk Browser Chrome.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-25 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-25 UTC."],[[["\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)."]]