See the supported connectors for Application Integration.

View OpenAPI Specification for your integration

Application Integration provides the ability to dynamically generate and view the OpenAPI Specifications of your published integrations that are configured with one or more API triggers. Accessing the OpenAPI Specification of your integration allows you to:

  • Gain a comprehensive understanding of your integration's API endpoints, methods, and data structures.
  • Enable more efficient development and troubleshooting by providing a detailed and centralized view of your integration's API.
  • Expose your integration APIs and seamlessly integrate with conversational agents, such as Google Cloud conversational agents.

What is the OpenAPI Specification?

OpenAPI Specification logo

The OpenAPI Specification (OAS) is a standard, language-independent format to describe RESTful APIs. Commonly written in either YAML or JSON formats, the OpenAPI Specification presents a formal description of the API elements such as its base URL, paths and verbs, headers, query parameters, content types, request and response models, and more. For more information about the OpenAPI Specification, see OpenAPI Specification.

Generate and view the OpenAPI Specification

You can dynamically generate and view the OpenAPI Specification for your integrations from the Integration editor in the Google Cloud console or using an API call.

Before you begin

  • Confirm that your integration is configured with one or more API triggers. For information about configuring API triggers, see API triggers.
  • Publish your integration. For information about how to publish an integration, see Test and publish integrations.

View OpenAPI Specification

To view the OpenAPI Specification for your integration, select one of the options:

Console

To view the OpenAPI Specification for a specific integration, do the following steps:

  1. Go to the Application Integration page.

    Go to Application Integration

  2. In the navigation menu, click Integrations.

    The Integrations page appears, listing all the integrations available in the Google Cloud project.

  3. Click the integration for which you want to view the OpenAPI Specification. This opens the integration in the Integration editor.
  4. Click the (Actions menu) in the Integration editor toolbar, and select View OpenAPI spec.

    The View OpenAPI spec pane appears displaying the OpenAPI Specification of the integration. The generated OpenAPI Specification, by default, contains all the API triggers configured in the integration.

    • To view the OpenAPI Specification for a specific API trigger, select the API trigger from the APIs drop-down list.
    • To download the OpenAPI Specification as a YAML file, click download (Download).

API

The generateOpenApiSpec method of the Application Integration API allows you to view the OpenAPI Specification for your integration using an API call.

Use the following curl command to view the OpenAPI Specification for one or more integrations in the same region:

curl -X POST \
    -H "authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -d '{
    "apiTriggerResources": [{
    "integrationResource": "INTEGRATION_NAME",
    "triggerId": ["api_trigger/TRIGGER_NAME", "api_trigger/TRIGGER_NAME_2", "api_trigger/TRIGGER_NAME_n"]
    },
    {
    "integrationResource": "INTEGRATION_NAME",
      "triggerId": ["api_trigger/TRIGGER_NAME"]
    }],
    "fileFormat": "DOC_TYPE"
    }' \
    "https://LOCATION-integrations.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/integrations/-:generateOpenApiSpec"
          

Replace the following:

  • TRIGGER_NAME, TRIGGER_NAME_2, TRIGGER_NAME_n: The names of the API trigger in your integration which you want to view the OpenAPI Specification for.
  • INTEGRATION_NAME: The name of your integration.
  • DOC_TYPE: The type of document to generate. The following values are supported: YAML or JSON.
  • PROJECT_ID: The ID of your Google Cloud project.
  • LOCATION: The location of your Google Cloud project.

Understanding the OpenAPI Specification

Application Integration generates the OpenAPI Specification for your published integrations following the OpenAPI Specification 3.0 standard. The following table describes the elements of the OpenAPI Specification generated in Application Integration:

Element Description
openapi The OpenAPI Specification version used.
info Information about the integration, such as its name (title), description, and published version.
servers The server URLs that host the integration.
paths Paths are created for each selected API trigger in the integration. The server URL combined with the path constitutes the API endpoint for making API calls.

Request and Response fields are populated based on the input and output variables configured for the corresponding API trigger.

components The schemas field contains the JSON schema for the input and output variables of the API trigger.

The securitySchemes field contains the authentication information for the API triggers.

Considerations

The following considerations apply when viewing the OpenAPI Specification for your integration:

  • The OpenAPI Specification is generated only for published integrations.
  • The OpenAPI Specification is generated only for integrations configured with one or more API triggers.
  • The OpenAPI Specification is generated only for integrations in the same region.
  • The OpenAPI Specification is generated in YAML format by default. To generate and view the OpenAPI Specification in JSON format, set the fileFormat parameter to JSON in the API call.
  • Application Integration currently supports only the following limited set of JSON schema keywords:
    • type
    • items
    • properties
    • description
    • required
    • array
    • object
    • oneOf
    • allOf
    • anyOf
    • not
    • null
    • enum
    • additionalProperties
    • default
  • When validating the OpenAPI specification using the Swagger Editor, you may encounter semantic errors related to the API paths similar to the following image:

    Swagger Editor Swagger Editor

    These errors can be safely ignored. The OpenAPI Specification is still valid.