Skip to main content
Version: Next

HTTP(S)

Tenzir supports HTTP and HTTPS, both as sender and receiver.

When retrieving data from an API or website, you prepare your HTTP request and get back the HTTP response body as your pipeline data:

When sending data from a pipeline to an API or website, the events in the pipeline make up the HTTP request body. If the HTTP status code is not 2**, you will get a warning.

In both cases, you can only provide static header data.

URL Support

The URL schemes http:// and https:// dispatch to load_http and save_http for seamless URL-style use via from and to.

Since the majority of HTTP activity uses JSON-encoded request/response bodies, you do not need to provide a separate pipeline argument with read_json and write_ndjson.

Examples

Perform a GET request with URL parameters

from "http://example.com:8888/api", method="GET", params={query: "tenzir"}

Perform a POST request with JSON body

from "http://example.com:8888/api", method="POST", data={query: "tenzir"}

Call a webhook API with pipeline data

from {
  x: 42,
  y: "foo",
}
to "http://example.com:8888/api"