steampipe plugin install openapi

Table: openapi_path - Query OpenAPI Paths using SQL

OpenAPI is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services. It provides a way to describe the capabilities of a service in a standard, language-agnostic manner. This allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic.

Table Usage Guide

The openapi_path table provides insights into the paths defined within an OpenAPI specification. As a developer or API designer, explore path-specific details through this table, including the available operations, parameters, and responses. Utilize it to uncover information about the API's structure, such as the available endpoints, the HTTP methods they support, and the expected request and response formats.

Examples

Basic info

Explore the API paths in a project to determine if any are outdated or no longer in use. This can assist in maintaining the efficiency of your code by identifying and removing unnecessary elements.

select
api_path,
deprecated,
description,
tags,
path
from
openapi_path;
select
api_path,
deprecated,
description,
tags,
path
from
openapi_path;

List all deprecated endpoints

Uncover the details of outdated API endpoints in your application. This can help you identify areas that may need updates or replacement, ensuring your application stays current and secure.

select
api_path,
description,
tags,
path
from
openapi_path
where
deprecated;
select
api_path,
description,
tags,
path
from
openapi_path
where
deprecated = 1;

List all GET method endpoints

Explore all endpoints that use the GET method to understand how your API interacts with data. This can help optimize the performance and security of your API by identifying potential areas for improvement.

select
api_path,
description,
parameters,
path
from
openapi_path
where
method = 'GET';
select
api_path,
description,
parameters,
path
from
openapi_path
where
method = 'GET';

Get the parameters required for a specific endpoint

Explore the required parameters for a specific endpoint to better understand its necessary inputs and structure. This is particularly useful for ensuring proper API calls and data retrieval.

select
api_path,
p ->> 'name' as param,
case
when p -> 'required' is not null then true
else false
end as is_required,
jsonb_pretty(p -> 'schema') as schema,
path
from
openapi_path,
jsonb_array_elements(parameters) as p
where
api_path = '/org/{org_handle}/audit_log/get';
select
api_path,
json_extract(p.value, '$.name') as param,
case
when json_extract(p.value, '$.required') is not null then 1
else 0
end as is_required,
p.value as schema,
path
from
openapi_path,
json_each(parameters) as p
where
api_path = '/org/{org_handle}/audit_log/get';

Get the success response schema of a specific endpoint

Explore the structure of a successful response from a specific API endpoint. This can be useful to understand the data format and fields returned upon successful API calls, aiding in the development of applications that interact with this endpoint.

select
api_path,
jsonb_pretty(responses -> '200') as success_response,
path
from
openapi_path
where
api_path = '/identity/{identity_handle}/get';
select
api_path,
responses as success_response,
path
from
openapi_path
where
api_path = '/identity/{identity_handle}/get';

Schema for openapi_path

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
api_pathtextA relative path to an individual endpoint.
callbacksjsonbA map of possible out-of band callbacks related to the parent operation.
deprecatedbooleanTrue, if the operation to be deprecated.
descriptiontextA verbose explanation of the operation behavior.
external_docsjsonbAdditional external documentation for this operation.
methodtextSpecify the HTTP method.
operation_idtextUnique string used to identify the operation.
parametersjsonbA list of parameters that are applicable for this operation.
pathtext=Path to the file.
request_bodyjsonbThe request body applicable for this operation.
responsesjsonbThe list of possible responses as they are returned from executing this operation.
securityjsonbA declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used.
serversjsonbAn alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
summarytextA short summary of what the operation does.
tagsjsonbA list of tags for API documentation control.

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