Exemplos de código para a API Chrome Management Profiles

Acesse a API Chrome Management Profiles para ter uma visão geral dos recursos da API.

Todas as solicitações mostradas nesta página usam as seguintes variáveis:

  • $TOKEN: token OAuth 2.0
  • $CUSTOMER: ID do cliente ou my_customer literal

Listar perfis gerenciados

Para listar os perfis gerenciados, use o endpoint /profiles. É possível controlar a paginação dos resultados usando os parâmetros pageSize e pageToken. Use orderBy para especificar a ordem dos resultados. Especifique um filter para restringir ainda mais os resultados. Uma máscara de leitura pode ser especificada com o parâmetro de consulta fields. A eficiência pode ser melhorada ao listar perfis com uma máscara de leitura que exclua o campo reportingData.

Solicitação

  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"

Resposta

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

Extrair um perfil gerenciado

Para recuperar um perfil gerenciado, use o endpoint /profiles/{profile_permanent_id}. Uma máscara de leitura pode ser especificada com o parâmetro fields.

Solicitação

  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"

Resposta

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

Excluir os dados coletados de um perfil gerenciado

Para excluir os dados coletados de um perfil gerenciado, use o endpoint /profiles/{profile_permanent_id}.

Solicitação

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