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), pathfrom openapi_path_response;
select api_path, api_method, response_status, content, pathfrom 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), pathfrom openapi_path_responsewhere api_path = '/app/installations/get' and response_status = '200';
select api_path, api_method, response_status, content, pathfrom openapi_path_responsewhere 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 pathsfrom openapi_path_response, jsonb_array_elements(content) as cwhere c ->> 'schema' is null and response_ref is null;
select path, api_path || '.responses.' || response_status || '.content.' || json_extract(c.value, '$.contentType') as pathsfrom openapi_path_response, json_each(content) as cwhere json_extract(c.value, '$.schema') is null and response_ref is null;
Schema for openapi_path_response
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
api_method | text | Specifies the HTTP method. | |
api_path | text | The key of the response object definition. | |
content | jsonb | A map containing descriptions of potential response payloads. | |
description | text | A description of the response. | |
headers | jsonb | Maps a header name to its definition. | |
links | jsonb | A map of operations links that can be followed from the response. | |
path | text | = | Path to the file. |
response_ref | text | The reference to the components response object. | |
response_status | text | The key of the response object definition. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe 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