steampipe plugin install openapi

Table: openapi_path_response - Query OpenAPI Path Responses using SQL

OpenAPI is a specification for building APIs that offer a high degree of interoperability. The Path Response in OpenAPI provides detailed information about the responses that an API path can return. It is a critical component in understanding the behavior of the API and diagnosing potential issues.

Table Usage Guide

The openapi_path_response table provides insights into the responses returned by the API paths in an OpenAPI specification. As an API developer or tester, explore response-specific details through this table, including the status codes, descriptions, and associated schema. Utilize it to uncover information about the API's behavior, such as the responses it can return, their structure, and the status codes they are associated with.

Examples

Basic info

Explore the status of responses from various API paths and methods. This can help in identifying any irregularities or issues in the API's responses, improving overall system monitoring and troubleshooting.

select
api_path,
api_method,
response_status,
jsonb_pretty(content),
path
from
openapi_path_response;
select
api_path,
api_method,
response_status,
content,
path
from
openapi_path_response;

Get the response object for a specific API operation on success

Determine the success status of a specific API operation by analyzing the response object. This is useful for troubleshooting and optimizing API calls to ensure they are functioning as expected.

select
api_path,
api_method,
response_status,
jsonb_pretty(content),
path
from
openapi_path_response
where
api_path = '/app/installations/get'
and response_status = '200';
select
api_path,
api_method,
response_status,
content,
path
from
openapi_path_response
where
api_path = '/app/installations/get'
and response_status = '200';

List response definitions without schema

Explore which paths in the OpenAPI path response lack a defined schema. This is useful in identifying areas of your API that may need further definition or refinement.

select
path,
concat(
api_path,
'.responses.',
response_status,
'.content.',
c ->> 'contentType'
) as paths
from
openapi_path_response,
jsonb_array_elements(content) as c
where
c ->> 'schema' is null
and response_ref is null;
select
path,
api_path || '.responses.' || response_status || '.content.' || json_extract(c.value, '$.contentType') as paths
from
openapi_path_response,
json_each(content) as c
where
json_extract(c.value, '$.schema') is null
and response_ref is null;

Schema for openapi_path_response

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
api_methodtextSpecifies the HTTP method.
api_pathtextThe key of the response object definition.
contentjsonbA map containing descriptions of potential response payloads.
descriptiontextA description of the response.
headersjsonbMaps a header name to its definition.
linksjsonbA map of operations links that can be followed from the response.
pathtext=Path to the file.
response_reftextThe reference to the components response object.
response_statustextThe key of the response object definition.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- openapi

You can pass the configuration to the command with the --config argument:

steampipe_export_openapi --config '<your_config>' openapi_path_response