Chrome Management Profilleri API'si için Kod Örnekleri

API özelliklerine genel bakış için Chrome Management Profiles API sayfasını ziyaret edin.

Bu sayfada gösterilen tüm isteklerde aşağıdaki değişkenler kullanılır:

  • $TOKEN - OAuth 2.0 jetonu
  • $CUSTOMER - Müşterinin kimliği veya değişmez değer my_customer

Yönetilen Profilleri Listeleme

Yönetilen profilleri listelemek için /profiles uç noktasını kullanın. pageSize ve pageToken parametrelerini kullanarak sonuçların sayfalandırılmasını kontrol edebilirsiniz. Sonuçların sırasını belirtmek için orderBy özelliğini kullanın. Sonuçları daha da daraltmak için bir filter belirtin. fields sorgu parametresiyle bir okuma maskesi belirtilebilir. reportingData alanı hariç tutan bir okuma maskesiyle profillerin listelenmesi verimliliği artırabilir.

İstek

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/profiles?pageSize=2&orderBy=lastPolicySyncTime&filter=osPlatformType=WINDOWS+AND+affiliationState=PROFILE_ONLY&fields=chromeBrowserProfiles.name,chromeBrowserProfiles.profileId,chromeBrowserProfiles.profilePermanentId,chromeBrowserProfiles.displayName,chromeBrowserProfiles.userEmail,chromeBrowserProfiles.lastActivityTime,chromeBrowserProfiles.osPlatformType,chromeBrowserProfiles.policyCount,chromeBrowserProfiles.reportingData,chromeBrowserProfiles.identityProvider,chromeBrowserProfiles.affiliationState"

Yanıt

{
  "chromeBrowserProfiles": [
    {
      "name": "customers/<customerId>/profiles/<profilePermanentId1>",
      "profileId": "<profileId1>",
      "profilePermanentId": "<profilePermanentId1>",
      "displayName": "My profile 1",
      "userEmail": "<userEmail1>",
      "lastActivityTime": "2024-04-23T22:05:44.214362Z",
      "osPlatformType": "WINDOWS",
      "policyCount": "2",
      "reportingData": [
        {
          "browserExecutablePath": "<executablePath1>",
          "profilePath": "<profilePath1>",
          "extensionData":[
            {
              "extensionId": "ghbmnnjooekpmoecnnnilnnbdlolhkhi",
              "version": "1.76.1",
              "name": "Google Docs Offline",
              "extensionType": "EXTENSION",
              "homepageUri": "https://chrome.google.com/webstore/detail/ghbmnnjooekpmoecnnnilnnbdlolhkhi",
              "installationType": "NORMAL",
              "isDisabled": true,
              "isWebstoreExtension": true,
              "manifestVersion": 3
            }
          ],
          "policyData":[
            {
              "source": "MACHINE_PLATFORM",
              "name": "AutoSelectCertificateForUrls",
              "value": "\"********\""
            },
            {
              "source": "USER_CLOUD",
              "name": "BrowserThemeColor",
              "value": "\"#00FF00\""
            }
          ]
        }
      ],
      "identityProvider": "GOOGLE_IDENTITY_PROVIDER",
      "affiliationState": "PROFILE_ONLY"
    },
    {
      "name": "customers/<customerId>/profiles/<profilePermanentId2>",
      "profileId": "<profileId2>",
      "profilePermanentId": "<profilePermanentId2>",
      "displayName": "My profile 2",
      "userEmail": "<userEmail2>",
      "lastActivityTime": "2024-04-23T22:05:44.214362Z",
      "osPlatformType": "WINDOWS",
      "policyCount": "1",
      "reportingData": [
        {
          "browserExecutablePath": "<executablePath2>",
          "profilePath": "<profilePath2>",
          "policyData":[
            {
              "source": "USER_CLOUD",
              "name": "CloudProfileReportingEnabled",
              "value": "true"
            }
          ]
        }
      ],
      "identityProvider": "GOOGLE_IDENTITY_PROVIDER",
      "affiliationState": "PROFILE_ONLY"
    }
  ],
  "next_page_token": "<nextPageToken>",
  "total_size": "120"
}

Yönetilen profili alma

Yönetilen bir profili almak için /profiles/{profile_permanent_id} uç noktasını kullanın. Okuma maskesi, fields parametresiyle belirtilebilir.

İstek

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/profiles/<profilePermanentId1>?fields=chromeBrowserProfiles.name,chromeBrowserProfiles.profileId,chromeBrowserProfiles.profilePermanentId,chromeBrowserProfiles.displayName,chromeBrowserProfiles.userEmail,chromeBrowserProfiles.lastActivityTime,chromeBrowserProfiles.osPlatformType,chromeBrowserProfiles.policyCount,chromeBrowserProfiles.reportingData,chromeBrowserProfiles.identityProvider,chromeBrowserProfiles.affiliationState"

Yanıt

{
  "name": "customers/<customerId>/profiles/<profilePermanentId1>",
  "profileId": "<profileId1>",
  "profilePermanentId": "<profilePermanentId1>",
  "displayName": "My profile 1",
  "userEmail": "<userEmail1>",
  "lastActivityTime": "2024-04-23T22:05:44.214362Z",
  "osPlatformType": "WINDOWS",
  "policyCount": "2",
  "reportingData": [
    {
      "browserExecutablePath": "<executablePath1>",
      "profilePath": "<profilePath1>",
      "extensionData":[
        {
          "extensionId": "ghbmnnjooekpmoecnnnilnnbdlolhkhi",
          "version": "1.76.1",
          "name": "Google Docs Offline",
          "extensionType": "EXTENSION",
          "homepageUri": "https://chrome.google.com/webstore/detail/ghbmnnjooekpmoecnnnilnnbdlolhkhi",
          "installationType": "NORMAL",
          "isDisabled": true,
          "isWebstoreExtension": true,
          "manifestVersion": 3
        }
      ],
      "policyData":[
        {
          "source": "MACHINE_PLATFORM",
          "name": "AutoSelectCertificateForUrls",
          "value": "\"********\""
        },
        {
          "source": "USER_CLOUD",
          "name": "BrowserThemeColor",
          "value": "\"#00FF00\""
        }
      ]
    }
  ],
  "identityProvider": "GOOGLE_IDENTITY_PROVIDER",
  "affiliationState": "PROFILE_ONLY"
}

Yönetilen profilden toplanan verileri silme

Yönetilen profilden toplanan verileri silmek için /profiles/{profile_permanent_id} uç noktasını kullanın.

İstek

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

Yönetilen profile uzaktan komut verme

Yönetilen bir profile uzaktan komut göndermek için /profiles/{profile_permanent_id}/commands/ uç noktasını kullanın.

İstek

  curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"command_type":"clearBrowsingData", "payload":{clearCache:true, clearCookies:true}}' \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/profiles/<profilePermanentId1>/commands"

Yanıt

{
  "name": "customers/<customerId>/profiles/<profilePermanentId1>/commands/<commandId1>",
  "commandType": "clear_browsing_data",
  "payload": {
    "clear_cache": true,
    "clear_cookies": true
  },
  "commandState": "PENDING",
  "issueTime": "2025-04-05T16:43:37.668Z",
  "validDuration": "86400s"
}

Yönetilen profile verilen uzak komutu alma

Yönetilen bir profile verilen uzak komutu almak için /profiles/{profile_permanent_id}/commands/{command_id} uç noktasını kullanın.

İstek

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/profiles/<profilePermanentId1>/commands/<commandId1>"

Yanıt

{
  "name": "customers/<customerId>/profiles/<profilePermanentId1>/commands/<commandId1>",
  "commandType": "clear_browsing_data",
  "payload": {
    "clear_cache": true,
    "clear_cookies": true
  },
  "commandState": "EXECUTED_BY_CLIENT",
  "commandResult": {
    "resultType": "SUCCESS",
    "clientExecutionTime": "2025-04-05T14:01:51.082Z"
  },
  "issueTime": "2025-04-05T14:01:49.914Z",
  "validDuration": "86400s"
}

Yönetilen bir profile verilen uzaktan komutları listeleme

Yönetilen bir profile verilen uzaktan komutları listelemek için /profiles/{profile_permanent_id}/commands uç noktasını kullanın.

İstek

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/profiles/<profilePermanentId1>/commands?pageSize=2"

Yanıt

{
  "chromeBrowserProfileCommands": [
    {
      "name": "customers/<customerId>/profiles/<profilePermanentId1>/commands/<commandId1>",
      "commandType": "clear_browsing_data",
      "payload": {
        "clear_cache": true,
        "clear_cookies": true
      },
      "commandState": "EXECUTED_BY_CLIENT",
      "commandResult": {
        "resultType": "SUCCESS",
        "clientExecutionTime": "2025-04-05T14:01:51.082Z"
      },
      "issueTime": "2025-04-05T14:01:49.914Z",
      "validDuration": "86400s"
    },
    {
      "name": "customers/<customerId>/profiles/<profilePermanentId1>/commands/<commandId2>",
      "commandType": "clear_browsing_data",
      "payload": {
        "clear_cache": true,
        "clear_cookies": false
      },
      "commandState": "EXECUTED_BY_CLIENT",
      "commandResult": {
        "resultType": "SUCCESS",
        "clientExecutionTime": "2025-04-05T14:02:59.981Z"
      },
      "issueTime": "2025-04-05T14:02:59.192Z",
      "validDuration": "86400s"
    }
  ],
  "nextPageToken": "<nextPageToken>",
  "totalSize": "10"
}