Code Samples for the Chrome Management Reports API

Visit Chrome Management Reports API for an overview of API features.

All the requests shown below use the following variables:

  • $TOKEN - OAuth 2 token
  • $CUSTOMER - ID of the customer or literal my_customer
  • $ORG_UNIT_ID - ID of a particluar org unit for which you want to generate a request.

Count Chrome versions active in date range

To view which Chrome versions were active over a given range of time, use the last_active_date value in the filter parameter. You can control pagination of the results using the pageSize and pageToken parameters.

Request

  curl -X GET \
  --header "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"

Response

{
  "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
}

Count distribution of app installations with a number of permissions

To view the number of devices that have installed a particular app with a given number of permissions, use the number_of_permissions value in the filter parameter. You can control pagination of the results using the pageSize and pageToken parameters.

For more filter parameters, visit the reference.

Request

  curl -X GET \
  --header "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:countInstalledApps?filter=number_of_permissions>6"

Response

{
  "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"
      ]
    },
  ]
}

Count devices that have an installed app

The previous example showed an app that has been installed on 2 devices. To view the devices that have installed this app, you can use the findInstalledAppDevices custom method. You can control pagination of the results using the pageSize and pageToken parameters.

Request

  curl -X GET \
  --header "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/reports:findInstalledAppDevices?appType=app&appId=pnhechapfaindjhompbnflcldabbghjo"

Response

{
  "totalSize": 2,
  "devices": [
    {
      "machine": "MACHINEA-A",
      "deviceId": "b472473e-fe50-4c6e-9ac3-03fe0d0753ce"
    },
    {
      "machine": "MACHINE-B",
      "deviceId": "a5f49e54-b07b-409f-bc5c-aaf27c483249"
    }
  ]
}

Follow-up request

Given the device ID returned in the previous example, you can get more information about the device that has installed the app by using the Admin SDK Directory API for Chrome Browsers.