Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Benutzerdefinierten Connector und Verbindung erstellen
Auf dieser Seite wird beschrieben, wie Sie eine OpenAPI-Spezifikation für einen Webdienst erstellen und dann einen benutzerdefinierten Connector und eine Verbindung für diesen Connector erstellen.
Bevor Sie einen benutzerdefinierten Connector erstellen, müssen Sie eine OpenAPI-Spezifikation für den Webdienst erstellen.
OpenAPI-Spezifikation für den Webdienst erstellen
Benutzerdefinierte Connectors unterstützen OpenAPI 3.0. Sie können die Spezifikation auch manuell erstellen. Informationen zu den OpenAPI-Spezifikationen finden Sie unter OpenAPI-Spezifikationen.
Sie können die OpenAPI 2.0-Spezifikation auch automatisch mit der Gin-Swagger-Middleware generieren. Weitere Informationen finden Sie unter Gin Swagger. Sie müssen die OpenAPI 2.0-Spezifikation mit Swagger Converter in die OpenAPI 3.0-Spezifikation konvertieren.
Beispiel für eine OpenAPI-Spezifikation.
{"openapi":"3.0.0",
"info":{"title":"Go HTTPbin Proxy Service",
"description":"A simple Go service that proxies requests to httpbin.org, adding custom headers.",
"version":"1.0.0"},
"servers":[{"url":"http://localhost:8080"}],
"paths":{"/getData":{"get":{"summary":"Fetch data from httpbin.org/get",
"description":"Sends a GET request to httpbin.org/get, including any custom headers.",
"responses":{"200":{"description":"Successful response from httpbin.org",
"content":{"application/json":{"schema":{"type":"object"}}}}}}},
"/postData/{id}":{"post":{"summary":"Post data to httpbin.org/post",
"description":"Sends a POST request to httpbin.org/post with data, including any custom headers.",
"parameters":[{"in":"path",
"name":"id",
"required":true,
"schema":{"type":"string"}}],
"requestBody":{"content":{"application/json":{"schema":{"type":"object",
"properties":{"name":{"type":"string"},
"address":{"type":"string"},
"gender":{"type":"string"}},
"required":["name",
"address",
"gender"]}}}},
"responses":{"200":{"description":"Successful response from httpbin.org",
"content":{"application/json":{"schema":{"type":"object"}}}},
"400":{"description":"Bad Request - Invalid request body"}}}}}}
Benutzerdefinierten Connector erstellen und Dienst validieren
Sie müssen einen benutzerdefinierten Connector erstellen und den Webdienst dann validieren, indem Sie ihn in einer Verbindung in Application Integration verwenden.
Hinweise
Richten Sie Private Service Connect (PSC) für diese VM ein und erstellen Sie dann einen Endpunktanhang.
Benutzerdefinierten Connector erstellen
Rufen Sie in der Console die Seite Integration Connectors > Benutzerdefinierte Connectors auf und wählen Sie ein Google Cloud Projekt aus oder erstellen Sie eines.
Klicken Sie auf Neu erstellen, um die Seite Benutzerdefinierten Connector erstellen zu öffnen.
Geben Sie im Abschnitt Connector details (Connector-Details) die erforderlichen Felder an, z. B. Connector name (Connector-Name) und Display name (Anzeigename). Geben Sie außerdem die Anwendungsfälle für den Connector im Feld Description (Beschreibung) ein.
Connector-Ziel für den Back-End-Zugriff konfigurieren: Aktivieren Sie diese Option. Dadurch werden die zusätzlichen Konfigurationsabschnitte auf der Seite angezeigt.
Dienstkonto: Wählen Sie ein Dienstkonto mit den erforderlichen Rollen aus.
Logo: Laden Sie ein Bild in einen Cloud Storage-Bucket hoch, um es als Connector-Logo zu verwenden.
Geben Sie im Abschnitt Connector Specification (Connectorspezifikation) entweder die öffentliche URL Ihrer Open API-Spezifikation ein oder laden Sie Ihre Spezifikationsdatei in einen Cloud Storage-Bucket hoch.
Fügen Sie im Abschnitt Connector Destination (Connector-Ziel) die IP-Adresse des Endpunktanhangs und den Port hinzu, auf dem der Dienst ausgeführt wird.
Wählen Sie im Bereich Connector Authentication (Connector-Authentifizierung) die Option No Authentication (Keine Authentifizierung) aus. Authentifizierungstypen werden für Marketplace-Connectors nicht unterstützt.
Fügen Sie im Bereich Backend-Variablen die Variablen hinzu, die beim Erstellen der Verbindung als Eingabe verwendet werden sollen. Diese Variablen werden auf der Seite zum Erstellen von Verbindungen angezeigt und bei jedem API-Aufruf an den Dienst gesendet. Die Werte, die sich mit APIs nicht ändern, z. B. Anmeldedaten für das Drittanbieter-Backend, müssen in diesem Abschnitt hinzugefügt werden.
Erstellen Sie den benutzerdefinierten Connector. Achten Sie darauf, dass Sie ein Logo angegeben und die Anwendungsfälle für den benutzerdefinierten Connector beschrieben haben.
Verbindung herstellen
Nachdem Sie den benutzerdefinierten Connector erstellt haben, erstellen Sie die Verbindung für diesen Connector.
Rufen Sie in der Cloud Console die Seite Integration Connectors > Verbindungen auf und wählen Sie ein Google Cloud-Projekt aus oder erstellen Sie eines.
Klicken Sie auf Neu erstellen, um die Seite Verbindung erstellen zu öffnen.
Wählen Sie den benutzerdefinierten Connector aus, den Sie erstellt haben.
Fügen Sie Werte für die von Ihnen definierten Verbindungsfelder hinzu.
Verbindung erstellen
Dienst validieren
Erstellen Sie eine neue Integration, um den Dienst zu validieren.
Rufen Sie in der Google Cloud Console die Seite Application Integration auf und erstellen Sie dann eine Integration.
Fügen Sie den API-Trigger und die Connector-Aufgabe hinzu.
Konfigurieren Sie die Connector-Aufgabe so, dass die im vorherigen Schritt erstellte Verbindung verwendet wird. Fügen Sie bei Bedarf Data Mapper hinzu.
Richten Sie die connectorInputPayload für den Connector gemäß dem Schema ein.
Führen Sie die Integration aus, um zu prüfen, ob die Verbindung funktioniert.
Wenn die Integration erfolgreich ausgeführt wird und die erwartete Antwort zurückgibt, wird der Webdienst validiert.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThis document outlines the process of creating a custom connector and a connection for a web service, starting with crafting an OpenAPI specification.\u003c/p\u003e\n"],["\u003cp\u003ePre-GA offerings, including products and features described here, are subject to specific terms found in the Service Specific Terms section and are available "as is" with potentially limited support.\u003c/p\u003e\n"],["\u003cp\u003eThe creation of a custom connector involves defining connector details, configuring backend access, specifying the OpenAPI specification, and setting up connector authentication and backend variables.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating the custom connector, a connection must be established, which involves selecting the connector and providing values for the defined connection fields.\u003c/p\u003e\n"],["\u003cp\u003eTo validate the service, a new integration should be created in Application Integration, utilizing the connector and its associated connection to run and verify the response.\u003c/p\u003e\n"]]],[],null,["# Create a custom connector and a connection\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nCreate a custom connector and a connection\n==========================================\n\nThis page describes how to create an OpenAPI specification for a web service and then create a custom connector and a connection for this connector.\n\nBefore you create a custom connector, you must create an OpenAPI specification for the web service.\n\nCreate an OpenAPI specification for the web service\n---------------------------------------------------\n\nCustom connectors support OpenAPI 3.0. You can also manually create the specification. For information about the OpenAPI specifications, see [OpenAPI specifications](https://swagger.io/specification/).\n\nYou can also autogenerate the OpenAPI 2.0 specification using gin swagger middleware. For information, see [Gin Swagger](https://github.com/swaggo/gin-swagger). You must convert the OpenAPI 2.0 specification to OpenAPI v3.0 specification by using [Swagger Converter](https://converter.swagger.io/).\nSample OpenAPI specification. \n\n```bash\n{\n \"openapi\": \"3.0.0\",\n \"info\": {\n \"title\": \"Go HTTPbin Proxy Service\",\n \"description\": \"A simple Go service that proxies requests to httpbin.org, adding custom headers.\",\n \"version\": \"1.0.0\"\n },\n \"servers\": [\n {\n \"url\": \"http://localhost:8080\"\n }\n ],\n \"paths\": {\n \"/getData\": {\n \"get\": {\n \"summary\": \"Fetch data from httpbin.org/get\",\n \"description\": \"Sends a GET request to httpbin.org/get, including any custom headers.\",\n \"responses\": {\n \"200\": {\n \"description\": \"Successful response from httpbin.org\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\"\n }\n }\n }\n }\n }\n }\n },\n \"/postData/{id}\": {\n \"post\": {\n \"summary\": \"Post data to httpbin.org/post\",\n \"description\": \"Sends a POST request to httpbin.org/post with data, including any custom headers.\",\n \"parameters\": [\n {\n \"in\": \"path\",\n \"name\": \"id\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\" \n\n },\n \"address\": {\n \"type\": \"string\"\n },\n \"gender\": {\n \"type\": \"string\" \n }\n },\n \"required\": [\n \"name\",\n \"address\",\n \"gender\"\n ]\n }\n }\n }\n },\n \"responses\": {\n \"200\": {\n \"description\": \"Successful response from httpbin.org\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\"\n }\n }\n }\n },\n \"400\": {\n \"description\": \"Bad Request - Invalid request body\"\n }\n }\n }\n }\n }\n}\n```\n\nCreate a custom connector and validate the service\n--------------------------------------------------\n\nYou must create a custom connector and then validate the web service by using it in a connection in Application Integration.\n\n### Before you begin\n\nSet up [Private Service Connect](https://cloud.google.com/integration-connectors/docs/network-connectivity-private) (PSC) for this virtual machine and then create an endpoint attachment.\n\n### Create a custom connector\n\n1. In the [Console](https://console.cloud.google.com/), go to the **Integration Connectors \\\u003e Custom connectors** page, and then select or create a Google Cloud project.\n\n\n [Go to the Custom connectors page](https://console.cloud.google.com/connectors/custom-connectors)\n2. Click **Create new** to open the **Create custom connector** page.\n3. In the **Connector details** section, specify the required fields, such as **Connector name** and **Display name** .Also, enter the use cases for the connector in the **Description** field.\n4. **Configure connector destination for backend access**: Enable this option. This shows the additional configuration sections in the page.\n5. **Service account**: Select a service account that has the required roles.\n6. **Logo** : Upload an image to a Cloud Storage bucket to use it as the connector logo. **Note:** Ensure your Cloud Storage bucket has the [public access prevention](/storage/docs/using-public-access-prevention#console) disabled.\n7. In the **Connector Specification** section, either enter the public URL of your Open API specification or upload your specification file to a Cloud Storage bucket.\n8. In **Connector Destination** section, add the IP address of the endpoint attachment and the port on which service is running.\n9. In **Connector Authentication** section, select **No Authentication**. Authentication types are not supported for Marketplace connectors.\n10. In **Backend Variables** section, add the variables you want to take as input while creating the connection. These variables appear in the connection creation page and are sent on every API call made to the service. The values which will not change with APIs, such as third-party backend credentials must be added in this section.\n11. Create the custom connector. Ensure that you have specified a logo and described the use cases for the custom connector.\n\n### Create a connection\n\nAfter you create the custom connector, create the connection for this connector.\n\n1. In the [Cloud console](https://console.cloud.google.com), go to the **Integration Connectors \\\u003e Connections** page and then select or create a Google Cloud project.\n\n\n [Go to the Connections page](https://console.cloud.google.com/connectors/connections)\n2. Click **Create new** to open the **Create connection** page.\n3. Select the custom connector that you created.\n4. Add values for the connection fields that you had defined.\n5. Create the connection.\n\n### Validate the service\n\nTo validate the service, create a new integration.\n\n1. In the Google Cloud console, go to the **Application Integration** page and then create an integration.\n2. Add API trigger and the connector task.\n3. Configure the connector task to use the connection created in the earlier step. Add Data Mapper if required.\n4. Set up the connectorInputPayload for the connector as per the schema.\n5. Run the integration to verify that the connection is working.\n\nIf the Integration runs successfully and returns expected response, the web service is validated.\n\nWhat's next\n-----------\n\n- Learn how to [create a startup script for the web service](/integration-connectors/docs/marketplace/create-startup-script)."]]