OpenAPI icon

OpenAPI

Consume any OpenAPI/Swagger based API

API Endpoint

AI-generated

Overview

This node allows users to consume any API that is described by an OpenAPI/Swagger specification. It dynamically loads the OpenAPI spec from a provided URL, enabling users to select API operations and specify parameters and request bodies accordingly. The node supports overriding the base API URL, sending custom parameters, and handling different response formats including JSON, string, and binary. It is useful for integrating with APIs that have OpenAPI specs without needing to write custom code for each endpoint.

Use Case Examples

  1. Calling a REST API endpoint to retrieve data by specifying the operation and parameters defined in the OpenAPI spec.
  2. Sending data to an API endpoint with a JSON request body constructed dynamically based on the spec.
  3. Downloading a file from an API endpoint and handling the response as binary data.

Properties

Name Meaning
OpenAPI Specification URL URL of the OpenAPI/Swagger specification to load the API definition from.
Base API URL Override the server URL from the OpenAPI specification, useful if the spec does not provide a server URL or a different endpoint is needed.
Operation Parameters Parameters defined in the OpenAPI spec for the selected operation. Required parameters are added automatically; optional ones can be added as needed.
Custom Parameters Manually defined parameters sent in addition to the spec-defined operation parameters. Each parameter includes a name, value, and type (query, path, header, or cookie).
Request Body Request body as JSON, used for operations that require a body payload.
Options Additional options including response format (JSON, string, or binary) and request timeout in milliseconds.

Output

Binary

When the response format is set to binary, the node outputs the response data as binary, including the content type, allowing downstream nodes to handle files or other binary content.

JSON

  • data - The response data returned from the API call when response format is string.
  • error - Error message returned if the node execution fails and continueOnFail is enabled.

Dependencies

  • Requires an OpenAPI/Swagger specification URL to load the API definition.
  • Optionally uses credentials if provided for API authentication.

Troubleshooting

  • Invalid JSON in the request body will cause an error; ensure the JSON is correctly formatted.
  • If the OpenAPI specification URL is invalid or unreachable, the node will throw an error loading the spec.
  • Incorrect operation parameter format will cause an error; ensure the operation is selected from the loaded OpenAPI operations.
  • Timeout errors can occur if the API does not respond within the specified timeout; increase the timeout option if needed.

Links

  • OpenAPI Specification - Official documentation for the OpenAPI Specification, which this node uses to dynamically interact with APIs.

Discussion