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