HTTL CLI is a powerful and flexible HTTP client designed for the command line. It leverages the HTTL engine to provide a simple yet robust way to make HTTP requests from the terminal.
To install HTTL via npm, run:
npm install -g httl-cli
HTTL provides an intuitive syntax for making HTTP requests. The basic usage is:
httl <method> <url> [headers] [body_format] [body]
-
method: One of the following HTTP methods:
-
get
,post
,put
,delete
,patch
,head
,options
,connect
,trace
,lock
,unlock
,propfind
,proppatch
,copy
,move
,mkcol
,mkcalendar
,acl
,search
-
-
url: The URL for the request (absolute or relative when using a
.httl
config file). -
headers: Headers in
key:value
format, separated by spaces (e.g.,Authorization:Bearer token
). -
body_format: The format of the request body, one of:
-
--json
(default) --formdata
--urlencoded
--raw
--bin
-
-
body: The request body (e.g.,
'{ "name": "John" }'
).
httl get https://httl.dev/api/users
httl get users
(Requires a .httl
file with @base: https://httl.dev/api
)
httl get https://httl.dev/api/users Authorization:"Bearer token" Cache-Control:private
httl post https://httpbin.org/anything '{ "name": "John" }'
httl put https://httpbin.org/anything --formdata '{ "name": "John" }'
httl post https://httpbin.org/anything --urlencoded '{ "name": "John" }'
httl post https://httpbin.org/anything 'name=John&age=30'
httl post https://httpbin.org/anything --bin ./file.bin
httl post https://httpbin.org/anything < ./payload.json
HTTL can also execute .httl
files, allowing you to define reusable HTTP requests.
httl ./file.httl
httl < ./file.httl
httl <<EOF
@base: https://httl.dev/api
@auth-basic: admin admin
post /auth
EOF
For more details, visit the HTTL documentation.