turbot/net

GitHub
steampipe plugin install netsteampipe plugin install net

Table: net_http_request

Send an HTTP request to a host on a server in order to receive a response. A request body and headers can be provided with each request. Currently, the GET and POST methods are supported.

Note: A url must be provided in all queries to this table.

Examples

Send a GET request to GitHub API

select
url,
method,
response_status_code,
jsonb_pretty(response_body :: jsonb) as response_body
from
net_http_request
where
url = 'https://api.github.com/users/github';

Send a GET request with a modified user agent

select
url,
method,
response_status_code,
jsonb_pretty(request_headers) as request_headers,
response_body
from
net_http_request
where
url = 'http://httpbin.org/user-agent'
and request_headers = jsonb_object(
'{user-agent, accept}',
'{steampipe-test-user, application/json}'
);

Send a POST request with request body and headers

select
url,
method,
response_status_code,
jsonb_pretty(request_headers) as request_headers,
response_body
from
net_http_request
where
url = 'http://httpbin.org/anything'
and method = 'POST'
and request_body = jsonb_object(
'{username, password}',
'{steampipe, test_password}'
) :: text
and request_headers = jsonb_object('{content-type}', '{application/json}');

Send a GET request with multiple values for a request header

select
url,
method,
response_status_code,
jsonb_pretty(request_headers) as request_headers,
response_body
from
net_http_request
where
url = 'http://httpbin.org/anything'
and request_headers = '{
"authorization": "Basic YWxhZGRpbjpvcGVuc2VzYW2l",
"accept": ["application/json", "application/xml"]
}' :: jsonb;

Check for HTTP Strict Transport Security (HSTS) protection

select
url,
method,
response_status_code,
case
when response_headers -> 'Strict-Transport-Security' is not null then 'enabled'
else 'disabled'
end as hsts_protection
from
net_http_request
where
url = 'http://microsoft.com';

Query examples

Control examples

.inspect net_http_request

An HTTP request is made by a client, to a named host, which is located on a server.

NameTypeDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
follow_redirectsbooleanIf true, the requests will follow the redirects.
methodtextSpecifies the HTTP method (GET, POST).
request_bodytextThe request's body.
request_headersjsonbA map of headers passed in the request.
response_bodytextRepresents the response body.
response_errortextRepresents an error or failure, either from a non-successful HTTP status, an error while executing the request, or some other failure which occurred during the parsing of the response.
response_headersjsonbA map of response headers used by web applications to configure security defenses in web browsers.
response_status_codebigintHTTP status code is a server response to a browser's request.
urltextURL of the site.