1HTTP(1) User Commands HTTP(1)
2
3
4
6 http - manual page for http 1.0.3
7
9 usage: http [--json] [--form] [--pretty {all,colors,format,none}]
10
11 [--style STYLE] [--print WHAT] [--headers] [--body] [--verbose]
12 [--all] [--history-print WHAT] [--stream] [--output FILE]
13 [--download] [--continue] [--session SESSION_NAME_OR_PATH |
14 --session-read-only SESSION_NAME_OR_PATH] [--auth USER[:PASS]]
15 [--auth-type {basic,digest}] [--proxy PROTOCOL:PROXY_URL]
16 [--follow] [--max-redirects MAX_REDIRECTS] [--timeout SECONDS]
17 [--check-status] [--verify VERIFY] [--ssl
18 {ssl2.3,tls1,tls1.1,tls1.2}] [--cert CERT] [--cert-key CERT_KEY]
19 [--ignore-stdin] [--help] [--version] [--traceback]
20 [--default-scheme DEFAULT_SCHEME] [--debug] [METHOD] URL
21 [REQUEST_ITEM ...]
22
23 HTTPie - a CLI, cURL-like tool for humans. <http://httpie.org>
24
25 Positional Arguments:
26
27 These arguments come after any flags and in the order they are
28 listed here. Only URL is required.
29
30 METHOD
31
32 The HTTP method to be used for the request (GET, POST, PUT,
33 DELETE, ...).
34
35 This argument can be omitted in which case HTTPie will use POST
36 if there is some data to be sent, otherwise GET:
37
38 $ http example.org # => GET
39 $ http example.org hello=world # => POST
40
41 URL
42
43 The scheme defaults to 'http://' if the URL does not include
44 one. (You can override this with: --default-scheme=https)
45
46 You can also use a shorthand for localhost
47
48 $ http :3000 # => http://localhost:3000
49 $ http :/foo # => http://localhost/foo
50
51 REQUEST_ITEM
52
53 Optional key-value pairs to be included in the request. The sep‐
54 arator used determines the type:
55
56 ':' HTTP headers:
57
58 Referer:http://httpie.org
59 Cookie:foo=bar User-Agent:bacon/1.0
60
61 '==' URL parameters to be appended to the request URI:
62
63 search==httpie
64
65 '=' Data fields to be serialized into a JSON object (with
66 --json, -j)
67
68 or form data (with --form, -f):
69
70 name=HTTPie
71 language=Python description='CLI HTTP client'
72
73 ':=' Non-string JSON data fields (only with --json, -j):
74
75 awesome:=true
76 amount:=42 colors:='["red", "green", "blue"]'
77
78 '@' Form file fields (only with --form, -f):
79
80 cs@~/Documents/CV.pdf
81
82 '=@' A data field like '=', but takes a file path and embeds its
83 content:
84
85 essay=@Documents/essay.txt
86
87 ':=@' A raw JSON field like ':=', but takes a file path and
88 embeds its content:
89
90 package:=@./package.json
91
92 You can use a backslash to escape a colliding separator in the
93 field name:
94
95 field-name-with\:colon=value
96
97 Predefined Content Types:
98 --json, -j
99
100 (default) Data items from the command line are serialized as a
101 JSON object. The Content-Type and Accept headers are set to
102 application/json (if not specified).
103
104 --form, -f
105
106 Data items from the command line are serialized as form fields.
107
108 The Content-Type is set to application/x-www-form-urlencoded (if
109 not specified). The presence of any file fields results in a
110 multipart/form-data request.
111
112 Output Processing:
113 --pretty {all,colors,format,none}
114
115 Controls output processing. The value can be "none" to not pret‐
116 tify the output (default for redirected output), "all" to apply
117 both colors and formatting (default for terminal output), "col‐
118 ors", or "format".
119
120 --style STYLE, -s STYLE
121
122 Output coloring style (default is "auto"). One of:
123
124 abap, algol, algol_nu, arduino, auto, autumn, borland, bw, col‐
125 orful, default, emacs, friendly, fruity, igor, inkpot, lovelace,
126 manni, monokai, murphy, native, paraiso-dark, paraiso-light,
127 pastie, perldoc, rainbow_dash, rrt, sas, solarized, solar‐
128 ized-dark, solarized-light, stata, statadark, stata-light,
129 tango, trac, vim, vs, xcode
130
131 The "auto" style follows your terminal's ANSI color styles.
132
133 For non-auto styles to work properly, please make sure that the
134 $TERM environment variable is set to "xterm-256color" or similar
135 (e.g., via `export TERM=xterm-256color' in your ~/.bashrc).
136
137 Output Options:
138 --print WHAT, -p WHAT
139
140 String specifying what the output should contain:
141
142 'H' request headers 'B' request body 'h' response headers 'b'
143 response body
144
145 The default behaviour is 'hb' (i.e., the response headers and
146 body is printed), if standard output is not redirected. If the
147 output is piped to another program or to a file, then only the
148 response body is printed by default.
149
150 --headers, -h
151
152 Print only the response headers. Shortcut for --print=h.
153
154 --body, -b
155
156 Print only the response body. Shortcut for --print=b.
157
158 --verbose, -v
159
160 Verbose output. Print the whole request as well as the response.
161 Also print any intermediary requests/responses (such as redi‐
162 rects). It's a shortcut for: --all --print=bHhB
163
164 --all
165
166 By default, only the final request/response is shown. Use this
167 flag to show any intermediary requests/responses as well. Inter‐
168 mediary requests include followed redirects (with --follow), the
169 first unauthorized request when Digest auth is used
170 (--auth=digest), etc.
171
172 --history-print WHAT, -P WHAT
173
174 The same as --print, -p but applies only to intermediary
175 requests/responses (such as redirects) when their inclusion is
176 enabled with --all. If this options is not specified, then they
177 are formatted the same way as the final response.
178
179 --stream, -S
180
181 Always stream the output by line, i.e., behave like `tail -f'.
182
183 Without --stream and with --pretty (either set or implied),
184 HTTPie fetches the whole response before it outputs the pro‐
185 cessed data.
186
187 Set this option when you want to continuously display a pretti‐
188 fied long-lived response, such as one from the Twitter streaming
189 API.
190
191 It is useful also without --pretty: It ensures that the output
192 is flushed more often and in smaller chunks.
193
194 --output FILE, -o FILE
195
196 Save output to FILE instead of stdout. If --download is also
197 set, then only the response body is saved to FILE. Other parts
198 of the HTTP exchange are printed to stderr.
199
200 --download, -d
201
202 Do not print the response body to stdout. Rather, download it
203 and store it in a file. The filename is guessed unless specified
204 with --output [filename]. This action is similar to the default
205 behaviour of wget.
206
207 --continue, -c
208
209 Resume an interrupted download. Note that the --output option
210 needs to be specified as well.
211
212 Sessions:
213 --session SESSION_NAME_OR_PATH
214
215 Create, or reuse and update a session. Within a session, custom
216 headers, auth credential, as well as any cookies sent by the
217 server persist between requests.
218
219 Session files are stored in:
220
221 /builddir/.httpie/sessions/<HOST>/<SESSION_NAME>.json.
222
223 --session-read-only SESSION_NAME_OR_PATH
224
225 Create or read a session without updating it form the
226 request/response exchange.
227
228 Authentication:
229 --auth USER[:PASS], -a USER[:PASS]
230
231 If only the username is provided (-a username), HTTPie will
232 prompt for the password.
233
234 --auth-type {basic,digest}, -A {basic,digest}
235
236 The authentication mechanism to be used. Defaults to "basic".
237
238 "basic": Basic HTTP auth "digest": Digest HTTP auth
239
240 Network:
241 --proxy PROTOCOL:PROXY_URL
242
243 String mapping protocol to the URL of the proxy (e.g.
244 http:http://foo.bar:3128). You can specify multiple proxies with
245 different protocols.
246
247 --follow, -F
248
249 Follow 30x Location redirects.
250
251 --max-redirects MAX_REDIRECTS
252
253 By default, requests have a limit of 30 redirects (works with
254 --follow).
255
256 --timeout SECONDS
257
258 The connection timeout of the request in seconds. The default
259 value is 30 seconds.
260
261 --check-status
262
263 By default, HTTPie exits with 0 when no network or other fatal
264 errors occur. This flag instructs HTTPie to also check the HTTP
265 status code and exit with an error if the status indicates one.
266
267 When the server replies with a 4xx (Client Error) or 5xx (Server
268 Error) status code, HTTPie exits with 4 or 5 respectively. If
269 the response is a 3xx (Redirect) and --follow hasn't been set,
270 then the exit status is 3. Also an error message is written to
271 stderr if stdout is redirected.
272
273 SSL:
274 --verify VERIFY
275
276 Set to "no" (or "false") to skip checking the host's SSL cer‐
277 tificate. Defaults to "yes" ("true"). You can also pass the
278 path to a CA_BUNDLE file for private certs. (Or you can set the
279 REQUESTS_CA_BUNDLE environment variable instead.)
280
281 --ssl {ssl2.3,tls1,tls1.1,tls1.2}
282
283 The desired protocol version to use. This will default to SSL
284 v2.3 which will negotiate the highest protocol that both the
285 server and your installation of OpenSSL support. Available pro‐
286 tocols may vary depending on OpenSSL installation (only the sup‐
287 ported ones are shown here).
288
289 --cert CERT
290
291 You can specify a local cert to use as client side SSL certifi‐
292 cate. This file may either contain both private key and cer‐
293 tificate or you may specify --cert-key separately.
294
295 --cert-key CERT_KEY
296
297 The private key to use with SSL. Only needed if --cert is given
298 and the certificate file does not contain the private key.
299
300 Troubleshooting:
301 --ignore-stdin, -I
302
303 Do not attempt to read stdin.
304
305 --help
306
307 Show this help message and exit.
308
309 --version
310
311 Show version and exit.
312
313 --traceback
314
315 Prints the exception traceback should one occur.
316
317 --default-scheme DEFAULT_SCHEME
318
319 The default scheme to use if not specified in the URL.
320
321 --debug
322
323 Prints the exception traceback should one occur, as well as
324 other information useful for debugging HTTPie itself and for
325 reporting bugs.
326
327 For every --OPTION there is also a --no-OPTION that reverts OPTION to
328 its default value.
329
330 Suggestions and bug reports are greatly appreciated:
331
332 https://github.com/jakubroztocil/httpie/issues
333
335 The full documentation for http is maintained as a Texinfo manual. If
336 the info and http programs are properly installed at your site, the
337 command
338
339 info http
340
341 should give you access to the complete manual.
342
343
344
345http 1.0.3 July 2020 HTTP(1)