Skip to content
Latchkey

HTTPie http GET: Readable API Requests in CI

http GET example.com/api sends a GET request and pretty-prints the response headers and JSON body.

HTTPie trades curl's flag soup for a readable request grammar. GET is the default method, so http example.com/health already performs a GET.

What it does

http GET sends an HTTP GET request. HTTPie infers http:// when you omit the scheme, colorizes and indents JSON, and prints the response body to stdout. name==value items on the command line become URL query string parameters.

Common usage

Terminal
http GET example.com/api/users
http GET :8080/health          # localhost:8080
http GET example.com/search q==latchkey page==2
http --headers GET example.com/api   # response headers only

Options

Item / flagWhat it does
name==valueAdds a URL query string parameter
Header:valueSets a request header
--headers, -hPrint only the response headers
--body, -bPrint only the response body
--followFollow redirects (not followed by default)
--timeout <sec>Request timeout in seconds

In CI

HTTPie does not follow redirects by default, so a 301/302 to a health endpoint returns the redirect, not the target. Add --follow when hitting URLs that redirect. Pair with --check-status so a 4xx/5xx sets a non-zero exit code.

Common errors in CI

http: error: ConnectionError: HTTPConnectionPool(...): Max retries exceeded means the host or port is unreachable, usually a service that is not up yet; gate the request behind a readiness wait. http: error: Request timed out (30.0s) means the response exceeded the default timeout; raise --timeout or fix the slow endpoint. http: error: <urlopen error [Errno -2] Name or service not known> is DNS failing to resolve the host.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →