HTTPie (http): Readable API Calls in CI
HTTPie provides the http command, which sends an HTTP request using a terse syntax (key=value for JSON fields, key:value for headers) and pretty-prints the JSON response.
HTTPie is curl made readable. For smoke tests and webhook calls in CI, the field syntax and --check-status flag are the parts that matter.
What it does
The http command builds a request from positional items: name=value becomes a JSON body field, name:=value a raw JSON value (numbers, booleans, arrays), Name:value a header, and name==value a query-string parameter. It defaults to GET, switches to POST when there is a body, and sends/expects JSON.
Common usage
http GET httpbin.org/get search==term # query param
http POST api.example.com/users \
name=Ada role=admin active:=true # JSON body, raw bool
http GET api.example.com/me Authorization:"Bearer $TOKEN"
http --check-status --ignore-stdin GET https://example.com/healthOptions
| Syntax / flag | What it does |
|---|---|
| name=value | String field in the JSON body |
| name:=value | Raw JSON field (number, bool, array, object) |
| Header:value | Set a request header |
| name==value | Add a URL query parameter |
| --check-status | Exit non-zero on a 4xx/5xx response |
| --ignore-stdin | Do not read stdin (avoids hangs in pipelines) |
| -b / --body | Print only the response body |
| -d / --download | Download to a file like wget |
In CI
Add --check-status so a 500 response fails the step; by default HTTPie exits 0 even on error statuses. Always pass --ignore-stdin in pipelines, otherwise HTTPie may try to read a request body from a redirected stdin and behave unexpectedly. Use -b to capture just the JSON for piping into jq.
Common errors in CI
"http: command not found" (install with pip install httpie, apt-get install -y httpie, or brew install httpie). With --check-status, exit code 3 means a 3xx, 4 means 4xx, 5 means 5xx, and 2 means a request error such as DNS or connection failure. A pipeline that hangs on http means it is reading stdin; add --ignore-stdin.