http

An http step is used to make an HTTP request.

pipeline "get_astronauts" {
step "http" "whos_in_space" {
url = "http://api.open-notify.org/astros"
method = "get"
}
output "people_in_space" {
value = step.http.whos_in_space.response_body.people[*].name
}
}

Arguments

ArgumentTypeOptional?Description
urlStringRequiredThe URL for the request. Supported schemes are http and https
basic_authBlockOptionalA basic_auth block to specify a username and password using Basic Authentication
ca_cert_pemStringOptionalCertificate data of the Certificate Authority (CA) in PEM (RFC 1421) format.
insecureBooleanOptionalDisables verification of the server's certificate chain and hostname. Defaults to false
methodBooleanOptionalThe HTTP Method for the request. Allowed methods are a subset of methods defined in RFC7231 namely, get,head, and post, put, patch, delete. The default is post.
request_bodyStringOptionalThe request body as a string.
request_headersMapOptionalA map of request header field names and values.

This step also supports the common step arguments and attributes.

Attributes (Read-Only)

AttributeTypeDescription
response_bodyString or objectThe response body. If the Content-Type is application/json then Flowpipe will decode it and return it as an object, otherwise, it is returned as a string.
response_headersMap of StringA map of response header field names and values. Duplicate headers are concatenated according to RFC2616.
status_codeNumberThe HTTP response status code.

Basic Authentication

To use basic authentication, include a basic_auth block specifying a username and password. This will create the appropriate Authorization header and add it to the request.

step "http" "list_issues" {
method = "get"
url = "${param.api_base_url}/rest/api/2/search?jql=project=${param.project_key}"
request_headers = {
Content-Type = "application/json"
}
basic_auth {
username = param.user_email
password = param.token
}
}
AttributeTypeDescription
usernameStringThe basic auth username
passwordStringThe basic auth password