Muestras de código para la API de Chrome Management Security Insights

Consulta la API de Chrome Management Security Insights para obtener información sobre las funciones de la API .

Todas las solicitudes que se muestran a continuación usan las siguientes variables:

  • $TOKEN - Token de OAuth 2
  • $CUSTOMER: Es el ID del cliente o el literal my_customer.

Verifica el estado de habilitación de las estadísticas de tu dominio

Para verificar el estado de habilitación de las estadísticas de tu dominio, usa el método checkEnablementStatus.

Solicitud

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enterprise/securityInsights:checkEnablementStatus"

Respuesta

{
  "insightsState": "INSIGHTS_ENABLED"
}

Habilita las estadísticas de tu dominio

Para habilitar las estadísticas de tu dominio, usa el método enable. De manera opcional, puedes configurar conectores de Chrome para un conjunto específico de UO si proporcionas targetOus. Si no se establece targetOus, los conectores de Chrome se configuran en la UO raíz.

Solicitud

  curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "targetOus": [
      "/corp/sales",
      "/eng"
    ]
  }' \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enterprise/securityInsights:enable"

Respuesta

{
  "insightsState": "INSIGHTS_ENABLED"
}

Inhabilita las estadísticas de tu dominio

Para inhabilitar las estadísticas de tu dominio, usa el método disable.

Solicitud

  curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}' \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enterprise/securityInsights:disable"

Respuesta

{
  "insightsState": "INSIGHTS_DISABLED"
}

Consulta resúmenes de alto nivel de transferencias de contenido para tu dominio

Para recuperar resúmenes de alto nivel de las transferencias de contenido, usa el método queryContentTransfers.

Solicitud

  curl -G \
  -H "Authorization: Bearer $TOKEN" \
  --data-urlencode "filter=event_time >= \"2026-05-01T00:00:00Z\" AND event_time <= \"2026-05-02T00:00:00Z\"" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enterprise/securityInsights:queryContentTransfers"

Respuesta

{
  "summaries": [
    {
      "metric": "CONTENT_TRANSFERS_METRIC_TOTAL_SENSITIVE_TRANSFERS",
      "count": "918"
    },
    {
      "metric": "CONTENT_TRANSFERS_METRIC_TOTAL_DOWNLOADS",
      "count": "1537"
    },
    {
      "metric": "CONTENT_TRANSFERS_METRIC_TOTAL_UPLOADS",
      "count": "1532"
    },
    {
      "metric": "CONTENT_TRANSFERS_METRIC_SENSITIVE_UPLOADS",
      "count": "306"
    },
    {
      "metric": "CONTENT_TRANSFERS_METRIC_TOTAL_TRANSFERS",
      "count": "4596"
    },
    {
      "metric": "CONTENT_TRANSFERS_METRIC_SENSITIVE_PRINTS",
      "count": "305"
    },
    {
      "metric": "CONTENT_TRANSFERS_METRIC_SENSITIVE_DOWNLOADS",
      "count": "307"
    },
    {
      "metric": "CONTENT_TRANSFERS_METRIC_TOTAL_PRINTS",
      "count": "1527"
    }
  ]
}

Consulta resúmenes de transferencias de contenido con desgloses

Para consultar transferencias de contenido con desgloses por dimensión (p.ej., desglose por USER), usa el método queryContentTransfersBreakdowns.

Solicitud

  curl -G \
  -H "Authorization: Bearer $TOKEN" \
  --data-urlencode "breakdown=USER" \
  --data-urlencode "metric=CONTENT_TRANSFERS_METRIC_TOTAL_TRANSFERS" \
  --data-urlencode "fixedTimeRange=FIXED_TIME_RANGE_FOUR_WEEKS" \
  --data-urlencode "filter=user = \"user1\" AND event_time <= \"2026-05-01T00:00:00Z\"" \
  --data-urlencode "pageSize=5" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enterprise/securityInsights:queryContentTransfersBreakdowns"

Respuesta

{
  "contentTransfersBreakdowns": [
    {
      "user": "user1",
      "summary": {
        "metric": "CONTENT_TRANSFERS_METRIC_TOTAL_TRANSFERS",
        "count": "20"
      }
    }
  ]
}

Consulta resúmenes de alto nivel de visitas a URLs para tu dominio

Para recuperar resúmenes de alto nivel de visitas a URLs sospechosas, usa el método queryUrlVisits.

Solicitud

  curl -G \
  -H "Authorization: Bearer $TOKEN" \
  --data-urlencode "filter=event_time >= \"2026-05-01T00:00:00Z\" AND event_time <= \"2026-05-02T00:00:00Z\"" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enterprise/securityInsights:queryUrlVisits"

Respuesta

{
  "summaries": [
    {
      "metric": "URL_VISITS_METRIC_HIGH_RISK_URL_VISITS",
      "count": "286"
    },
    {
      "metric": "URL_VISITS_METRIC_LOW_RISK_URL_VISITS",
      "count": "287"
    },
    {
      "metric": "URL_VISITS_METRIC_TOTAL_SUSPICIOUS_URL_VISITS",
      "count": "859"
    },
    {
      "metric": "URL_VISITS_METRIC_MEDIUM_RISK_URL_VISITS",
      "count": "286"
    }
  ]
}

Consulta resúmenes de visitas a URLs con desgloses

Para consultar visitas a URLs con desgloses por dimensión (p.ej., desglose por EVENT_DOMAIN), usa el método queryUrlVisitsBreakdowns.

Solicitud

  curl -G \
  -H "Authorization: Bearer $TOKEN" \
  --data-urlencode "breakdown=EVENT_DOMAIN" \
  --data-urlencode "metric=URL_VISITS_METRIC_TOTAL_SUSPICIOUS_URL_VISITS" \
  --data-urlencode "fixedTimeRange=FIXED_TIME_RANGE_ONE_WEEK" \
  --data-urlencode "filter=event_domain = \"suspicious-domain.com\" AND event_time <= \"2026-05-01T00:00:00Z\"" \
  --data-urlencode "pageSize=5" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enterprise/securityInsights:queryUrlVisitsBreakdowns"

Respuesta

{
  "urlVisitsBreakdowns": [
    {
      "eventDomain": "suspicious-domain.com",
      "summary": {
        "metric": "URL_VISITS_METRIC_TOTAL_SUSPICIOUS_URL_VISITS",
        "count": "132"
      }
    }
  ]
}