Skip to content

http.request

Issue an HTTP request; capture the response as a registered fact

Properties

Property Type Required Description
auth object No -
body string No -
creates_when string No -
expect_json_keys array No -
expect_json_schema string No -
expect_status array No -
file string No -
follow_redirects integer No -
form object No -
headers object No -
idempotency_key string No -
json any No -
max_response_bytes integer No -
method string No -
probe object No -
redact_body boolean No -
retry_on array No -
reverse object No -
risk string No -
save_to string No -
skip_tls_verify boolean No -
timeout string No -
url string Yes -

Examples

# GET + register the parsed JSON for downstream steps
- name: Probe metadata
  http.request:
    url: https://api.example.com/v1/whoami
    method: GET
    expect_status: 200
  as: whoami

- log:
    msg: "logged in as {{ whoami.body.email }}"
# POST a JSON body with auth header
- http.request:
    url: https://api.example.com/v1/events
    method: POST
    headers:
      Authorization: "Bearer {{ env.API_TOKEN }}"
      Content-Type: application/json
    json_body:
      kind: deploy
      sha: "{{ git_sha }}"
    expect_status: 201

Platform Support

linux, darwin, windows, freebsd

Events Emitted

  • http.requested