Code Samples for the Connectors API

See Connectors API for information about API features.

All the requests on this page use the following variables:

  • $TOKEN - OAuth 2.0 token
  • $CUSTOMER - ID of the customer or literal my_customer
  • $PAGE_TOKEN - Page token obtained from previous page responses
  • $CONNECTOR_CONFIG_ID - ID of the connector config. Generated IDs are in the form of capitalized UUIDs (for example, 550E8400-E29B-41D4-A716-446655440000).

List connector configurations

To list connector configurations for your customer domain, use the list method. You can optionally provide page_size (or pageSize) and page_token (or pageToken) query parameters when paginating across results:

  • page_size / pageSize: The maximum number of connector configurations to return. The default page size is 50 if unspecified, and has a maximum of 100.
  • page_token / pageToken: A page token received from a previous list call.

Request

curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs?page_size=50&page_token=$PAGE_TOKEN"

Response

{
  "connectorConfigs": [
    {
      "name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
      "displayName": "Configuration 1",
      "type": "REPORTING",
      "details": {
        "googleSecOpsConfig": {
          "host": "example.googlesecops.com",
          "reportingSettings": {
            "enabledDefaultEvents": [
              "ALL_DEFAULT_EVENTS"
            ],
            "enabledOptInEvents": [
              "PASSWORD_BREACH_EVENT",
              "URL_NAVIGATION_EVENT"
            ],
            "enabledDeviceEvents": [
              "ALL_DEVICE_EVENTS"
            ]
          }
        }
      },
      "status": {
        "state": "ENABLED"
      }
    }
  ],
  "nextPageToken": "<next_page_token>"
}

Get a connector configuration

To retrieve a specific connector configuration by ID, use the get method.

Request

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

Response

{
  "name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
  "displayName": "Configuration 1",
  "type": "REPORTING",
  "details": {
    "googleSecOpsConfig": {
      "host": "example.googlesecops.com",
      "reportingSettings": {
        "enabledDefaultEvents": [
          "ALL_DEFAULT_EVENTS"
        ],
        "enabledOptInEvents": [
          "PASSWORD_BREACH_EVENT",
          "URL_NAVIGATION_EVENT"
        ],
        "enabledDeviceEvents": [
          "ALL_DEVICE_EVENTS"
        ]
      }
    }
  },
  "status": {
    "state": "ENABLED"
  }
}

Create a connector configuration

To create a new connector configuration for your customer domain, use the create method. You can optionally provide a custom ID by setting the connector_config_id (or connectorConfigId) query parameter. If no ID is provided, a capitalized UUID will be generated by the server.

Request

curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "Configuration 1",
    "type": "REPORTING",
    "details": {
      "googleSecOpsConfig": {
        "apiKey": "api-key",
        "host": "example.googlesecops.com",
        "reportingSettings": {
          "enabledDefaultEvents": [
            "ALL_DEFAULT_EVENTS"
          ],
          "enabledOptInEvents": [
            "PASSWORD_BREACH_EVENT"
          ],
          "enabledDeviceEvents": [
            "ALL_DEVICE_EVENTS"
          ]
        }
      }
    }
  }' \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs?connector_config_id=$CONNECTOR_CONFIG_ID"

Response

{
  "name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
  "displayName": "Configuration 1",
  "type": "REPORTING",
  "details": {
    "googleSecOpsConfig": {
      "host": "example.googlesecops.com",
      "reportingSettings": {
        "enabledDefaultEvents": [
          "ALL_DEFAULT_EVENTS"
        ],
        "enabledOptInEvents": [
          "PASSWORD_BREACH_EVENT"
        ],
        "enabledDeviceEvents": [
          "ALL_DEVICE_EVENTS"
        ]
      }
    }
  },
  "status": {
    "state": "ENABLED"
  }
}

Update a connector configuration

A connector configuration can be updated in one of the following ways:

  • No update mask: If no updateMask query parameter is provided, all fields set in the request will be updated.
  • With update mask: If an updateMask query parameter is specified, only the fields listed in the mask will be updated.
  • With update mask corresponding to *: If the updateMask is set to *, the update is treated as a full replacement (equivalent to create).

Example 1: Update mask targeting only displayName

In this option, providing updateMask=displayName ensures only displayName is updated, even if additional fields are supplied in the body.

Request

curl -X PATCH \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "Updated name"
  }' \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID?updateMask=displayName"

Response

{
  "name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
  "displayName": "Updated name",
  "type": "REPORTING",
  "details": {
    "googleSecOpsConfig": {
      "host": "example.googlesecops.com",
      "reportingSettings": {
        "enabledDefaultEvents": [
          "BROWSER_EXTENSION_INSTALL_EVENT"
        ],
        "enabledOptInEvents": [
          "PASSWORD_BREACH_EVENT"
        ],
        "enabledDeviceEvents": [
          "LOGIN_LOGOUT_EVENT"
        ]
      }
    }
  },
  "status": {
    "state": "ENABLED"
  }
}

Example 2: No update mask (updates all fields in request)

If updateMask is omitted from the request query string, all fields provided in the JSON payload are updated.

Request

curl -X PATCH \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "Updated again",
    "details": {
      "googleSecOpsConfig": {
        "reportingSettings": {
          "enabledDefaultEvents": [
            "BROWSER_EXTENSION_INSTALL_EVENT",
            "CONTENT_TRANSFER_EVENT",
            "CONTENT_UNSCANNED_EVENT",
            "DATA_ACCESS_CONTROL_EVENT",
            "MALWARE_TRANSFER_EVENT"
          ]
        }
      }
    }
  }' \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID"

Response

{
  "name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
  "displayName": "Updated again",
  "type": "REPORTING",
  "details": {
    "googleSecOpsConfig": {
      "host": "example.googlesecops.com",
      "reportingSettings": {
        "enabledDefaultEvents": [
          "BROWSER_EXTENSION_INSTALL_EVENT",
          "CONTENT_TRANSFER_EVENT",
          "CONTENT_UNSCANNED_EVENT",
          "DATA_ACCESS_CONTROL_EVENT",
          "MALWARE_TRANSFER_EVENT"
        ],
        "enabledOptInEvents": [
          "PASSWORD_BREACH_EVENT"
        ],
        "enabledDeviceEvents": [
          "ALL_DEVICE_EVENTS"
        ]
      }
    }
  },
  "status": {
    "state": "ENABLED"
  }
}

Example 3: Update mask of * (full replacement)

Setting updateMask=* completely replaces the existing configuration with the payload provided in the request body.

Request

curl -X PATCH \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "New Updated Display Name",
    "type": "REPORTING",
    "details": {
      "googleSecOpsConfig": {
        "apiKey": "api-key",
        "host": "example.googlesecops.com",
        "reportingSettings": {
          "enabledOptInEvents": [
            "PASSWORD_BREACH_EVENT"
          ]
        }
      }
    }
  }' \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID?updateMask=*"

Response

{
  "name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
  "displayName": "New Updated Display Name",
  "type": "REPORTING",
  "details": {
    "googleSecOpsConfig": {
      "host": "example.googlesecops.com",
      "reportingSettings": {
        "enabledOptInEvents": [
          "PASSWORD_BREACH_EVENT"
        ]
      }
    }
  },
  "status": {
    "state": "ENABLED"
  }
}

Delete a connector configuration

To delete a connector configuration, use the delete method.

Request

curl -X DELETE \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID"

Response

{}