This page describes how to configure a connection to a generic HTTP endpoint.

In addition to the Git repository connections and
[account connectors](https://docs.cloud.google.com/developer-connect/docs/account-connectors),
you can also set up a Developer Connect connection to a generic HTTP
endpoint. This lets you establish and manage connections to many third-party
developer tools, services, and APIs, as long as those tools are accessible using
HTTP endpoints.

## Create an HTTP connection

HTTP connections support
[Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication)
(username and password) and
[bearer token authentication](https://datatracker.ietf.org/doc/html/rfc6750).
Both authentication types require that you
[create a secret](https://docs.cloud.google.com/secret-manager/docs/creating-and-accessing-secrets) in
Secret Manager.

### Bearer token auth

1. Use Secret Manager to
   [create a secret](https://docs.cloud.google.com/secret-manager/docs/creating-and-accessing-secrets) and a
   secret version, containing your token.

   The token is your personal access token or API token that give you access
   to the tool for which you're creating this connection.
2. To create the connection using
   bearer token authentication, run the following command:

       gcloud developer-connect connections create CONNECTION_ID \
       --location=REGION \
       --project=PROJECT_ID \
       --http-config-host-uri=HOST_URI \
       --http-config-bearer-token-authentication-secret-version=TOKEN_SECRET_VERSION \
       --http-config-service-directory=SERVICE_DIRECTORY_SERVICE \
       --http-config-ssl-ca-certificate=SSL_CERTIFICATE_FILE_PATH \
       --git-proxy-config-enabled

   Replace the following:
   - <var translate="no">CONNECTION_ID</var> with a unique ID for this new connection.
   - <var translate="no">REGION</var> with the Google Cloud region in which you're creating this connection.
   - <var translate="no">PROJECT_ID</var> with the Google Cloud project ID.
   - <var translate="no">HOST_URI</var> with the base HTTPS endpoint (for example, https://api.myservice.com).
   - <var translate="no">TOKEN_SECRET_VERSION</var> with the [Secret Manager](https://docs.cloud.google.com/secret-manager/docs/overview) secret version resource name for the authentication token.
   - <var translate="no">SERVICE_DIRECTORY_SERVICE</var> with the [Service Directory](https://docs.cloud.google.com/service-directory/docs/overview) resource name for private network access. This is optional.
   - <var translate="no">SSL_CERTIFICATE_FILE_PATH</var> with the path to a local file containing the SSL CA certificate content. This is optional.
   - Include the `--git-proxy-config-enabled` option to access this connection using the [Developer Connect proxy](https://docs.cloud.google.com/developer-connect/docs/configure-git-proxy).

### Basic auth

1. Use Secret Manager to
   [create a secret](https://docs.cloud.google.com/secret-manager/docs/creating-and-accessing-secrets) and a
   secret version, containing your username and password.

2. To create the connection using basic authentication, run the following
   command:

       gcloud developer-connect connections create CONNECTION_ID \
       --location=REGION \
       --project=PROJECT_ID \
       --http-config-host-uri=HOST_URI \
       --http-config-basic-authentication-username=USERNAME \
       --http-config-basic-authentication-password-secret-version=PASSWORD_SECRET_VERSION \
       --http-config-service-directory=SERVICE_DIRECTORY_SERVICE \
       --http-config-ssl-ca-certificate=SSL_CERTIFICATE_FILE_PATH \
       --git-proxy-config-enabled \

   Replace the following:
   - <var translate="no">CONNECTION_ID</var> with a unique ID for this new connection.
   - <var translate="no">REGION</var> with the Google Cloud region in which you're creating this connection.
   - <var translate="no">PROJECT_ID</var> with the Google Cloud project ID.
   - <var translate="no">HOST_URI</var> with the base HTTPS endpoint (for example, https://api.myservice.com).
   - <var translate="no">USERNAME</var> with the username for basic username-password authentication.
   - <var translate="no">PASSWORD_SECRET_VERSION</var> with the [Secret Manager](https://docs.cloud.google.com/secret-manager/docs/overview) secret version resource name for the password, for basic username-password authentication. (For example: `projects/01234567890/secrets/exampletool-api-pw/versions/1`.)
   - <var translate="no">SERVICE_DIRECTORY_SERVICE</var> with the [Service Directory](https://docs.cloud.google.com/service-directory/docs/overview) resource name for private network access. This is optional.
   - <var translate="no">SSL_CERTIFICATE_FILE_PATH</var> with the path to a local file containing the SSL CA certificate content. This is optional.
   - Include the `--git-proxy-config-enabled` option to access this connection using the [Developer Connect proxy](https://docs.cloud.google.com/developer-connect/docs/configure-git-proxy).

After the connection is created, you can access it using the connection resource
name in Developer Connect.