Chrome Management Chrome Browsers API のコードサンプル

API 機能の概要については、Chrome Management Chrome Browsers API をご覧ください。

このページに示されているリクエストでは、次の変数を使用します。

  • $TOKEN - OAuth 2.0 トークン
  • $CUSTOMER - 顧客の ID またはリテラル my_customer

登録済みの Chrome ブラウザを一覧表示する

登録済みの Chrome ブラウザを一覧表示するには、/chromeBrowsers エンドポイントを使用します。ページネーションは、pageSize(最大値とデフォルト値は 100)パラメータと pageToken パラメータを使用して制御できます。orderBy を使用して、結果の順序を指定します。filter を指定して、結果を絞り込みます。読み取りマスクは、fields クエリ パラメータで指定できます。

ワイルドカード(*)一致(プレフィックス prefix*、サフィックス *suffix、部分文字列 *substring*、存在 *)は、machine_name、annotated_asset_id、browser_version フィールドでのみ = と : でサポートされます。

グローバル テキスト検索(フィールド名を指定しない)では、インデックス登録されたすべてのテキスト フィールドが検索されます。複数の語句が AND または空白(filter=machine AND 73 や filter=machine 73 など)で区切られている場合、すべての語句がブラウザ デバイスのインデックス付きテキスト フィールドの少なくとも 1 つと一致する必要があります(異なるフィールド間でも一致する必要があります)。複数の単語を 1 つの引用符付き文字列で囲む(filter="machine name" など)と、1 つのフィールド内でその連続するフレーズが完全に一致するものが検索されます。

フィルタクエリの例

# Filter by machine name prefix (using ':' or '=')
filter=machine_name:LIX*

# Filter by annotated asset ID suffix
filter=annotated_asset_id="*1001"

# Filter by browser version substring
filter=browser_version:"*6367*"

# Global search across all indexed text fields (matches browsers containing both "machine" and "73" across any fields)
filter=machine AND 73

# Global search with implicit AND (equivalent to `machine AND 73`)
filter=machine 73

# Filter by machine name prefix and registration time range
filter=machine_name:LIX* AND last_registration_time>=2024-01-01T00:00:00Z

# Filter by Organizational Unit path
filter=org_unit_path=/Marketing

リクエスト

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers?pageSize=2&orderBy=lastActivityTime+desc&filter=os_platform=WINDOWS"

レスポンス

{
  "chromeBrowsers": [
    {
      "name": "customers/<customerId>/chromeBrowsers/<browserPermanentId1>",
      "browserPermanentId": "<browserPermanentId1>",
      "machineName": "CLIENT2024-01",
      "osPlatformType": "WINDOWS",
      "osVersion": "10.0.19045",
      "browserVersion": "124.0.6367.60",
      "annotatedUser": "user1@example.com",
      "annotatedLocation": "US-NYC",
      "annotatedAssetId": "ASSET-1001",
      "annotatedNotes": "Engineering workstation",
      "lastActivityTime": "2024-04-23T22:05:44.214362Z",
      "lastPolicySyncTime": "2024-04-23T22:00:00.000Z",
      "lastStatusReportTime": "2024-04-23T22:05:44.214362Z",
      "enrollmentDate": "2024-01-15T10:30:00.000Z",
      "orgUnitPath": "/Engineering",
      "policyCount": 15,
      "extensionCount": 8
    },
    {
      "name": "customers/<customerId>/chromeBrowsers/<browserPermanentId2>",
      "browserPermanentId": "<browserPermanentId2>",
      "machineName": "CLIENT2024-02",
      "osPlatformType": "WINDOWS",
      "osVersion": "11.0.22631",
      "browserVersion": "124.0.6367.60",
      "annotatedUser": "user2@example.com",
      "annotatedLocation": "US-MTV",
      "lastActivityTime": "2024-04-23T21:45:10.102000Z",
      "lastPolicySyncTime": "2024-04-23T21:40:00.000Z",
      "lastStatusReportTime": "2024-04-23T21:45:10.102000Z",
      "enrollmentDate": "2024-02-10T14:15:00.000Z",
      "orgUnitPath": "/Engineering",
      "policyCount": 12,
      "extensionCount": 5
    }
  ],
  "nextPageToken": "<nextPageToken>"
}

管理対象の Chrome ブラウザを取得する

登録済みの Chrome ブラウザを 1 つ取得するには、/chromeBrowsers/{browser_permanent_id} エンドポイントを使用します。読み取りマスクは、fields パラメータで指定できます。

リクエスト

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers/<browserPermanentId1>"

レスポンス

{
  "name": "customers/<customerId>/chromeBrowsers/<browserPermanentId1>",
  "browserPermanentId": "<browserPermanentId1>",
  "machineName": "CLIENT2024-01",
  "osPlatformType": "WINDOWS",
  "osVersion": "10.0.19045",
  "browserVersion": "124.0.6367.60",
  "annotatedUser": "user1@example.com",
  "annotatedLocation": "US-NYC",
  "annotatedAssetId": "ASSET-1001",
  "annotatedNotes": "Engineering workstation",
  "lastActivityTime": "2024-04-23T22:05:44.214362Z",
  "lastPolicySyncTime": "2024-04-23T22:00:00.000Z",
  "lastStatusReportTime": "2024-04-23T22:05:44.214362Z",
  "enrollmentDate": "2024-01-15T10:30:00.000Z",
  "orgUnitPath": "/Engineering",
  "policyCount": 15,
  "extensionCount": 8
}

Chrome ブラウザのアノテーション情報を更新する

登録済みの Chrome ブラウザのアノテーション付きフィールドを更新するには、HTTP PATCH メソッドで /chromeBrowsers/{browser_permanent_id} エンドポイントを使用し、更新するフィールドを指定する updateMask クエリ パラメータを指定します。

リクエスト

  curl -X PATCH \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers/<browserPermanentId1>?updateMask=annotatedUser,annotatedNotes" \
  -d '{
    "annotatedUser": "newuser@example.com",
    "annotatedNotes": "Updated primary workstation"
  }'

レスポンス

{
  "name": "customers/<customerId>/chromeBrowsers/<browserPermanentId1>",
  "browserPermanentId": "<browserPermanentId1>",
  "machineName": "CLIENT2024-01",
  "osPlatformType": "WINDOWS",
  "osVersion": "10.0.19045",
  "browserVersion": "124.0.6367.60",
  "annotatedUser": "newuser@example.com",
  "annotatedLocation": "US-NYC",
  "annotatedAssetId": "ASSET-1001",
  "annotatedNotes": "Updated primary workstation",
  "lastActivityTime": "2024-04-23T22:05:44.214362Z",
  "orgUnitPath": "/Engineering"
}

Chrome ブラウザを新しい組織部門に移動する

管理対象の Chrome ブラウザを組織部門間で移動するには、/chromeBrowsers:move エンドポイントを使用します。リクエストごとに最大 600 個のブラウザを移動できます。ブラウザの移動中にエラーが発生した場合、指定されたブラウザは移動されません。

リクエスト

  curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers:move" \
  -d '{
    "destinationOrgUnitId": "03ph8a2z3v",
    "resourceIds": [
      "customers/$CUSTOMER/chromeBrowsers/<browserPermanentId1>",
      "customers/$CUSTOMER/chromeBrowsers/<browserPermanentId2>"
    ]
  }'

レスポンス

{}

Chrome ブラウザから収集されたデータを削除する

管理対象の Chrome ブラウザから収集されたデータを削除するには、HTTP DELETE で /chromeBrowsers/{browser_permanent_id} エンドポイントを使用します。

リクエスト

  curl -X DELETE \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers/<browserPermanentId1>"

レスポンス

{}