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, sas, solarized, solarized-dark,
127 solarized-light, stata, stata-dark, statalight, tango, trac,
128 vim, vs, xcode
129
130 For this option to work properly, please make sure that the
131 $TERM environment variable is set to "xterm-256color" or similar
132 (e.g., via `export TERM=xterm-256color' in your ~/.bashrc).
133
134 Output Options:
135 --print WHAT, -p WHAT
136
137 String specifying what the output should contain:
138
139 'H' request headers 'B' request body 'h' response headers 'b'
140 response body
141
142 The default behaviour is 'hb' (i.e., the response headers and
143 body is printed), if standard output is not redirected. If the
144 output is piped to another program or to a file, then only the
145 response body is printed by default.
146
147 --headers, -h
148
149 Print only the response headers. Shortcut for --print=h.
150
151 --body, -b
152
153 Print only the response body. Shortcut for --print=b.
154
155 --verbose, -v
156
157 Verbose output. Print the whole request as well as the response.
158 Also print any intermediary requests/responses (such as redi‐
159 rects). It's a shortcut for: --all --print=hHBb
160
161 --all
162
163 By default, only the final request/response is shown. Use this
164 flag to show any intermediary requests/responses as well. Inter‐
165 mediary requests include followed redirects (with --follow), the
166 first unauthorized request when Digest auth is used
167 (--auth=digest), etc.
168
169 --history-print WHAT, -P WHAT
170
171 The same as --print, -p but applies only to intermediary
172 requests/responses (such as redirects) when their inclusion is
173 enabled with --all. If this options is not specified, then they
174 are formatted the same way as the final response.
175
176 --stream, -S
177
178 Always stream the output by line, i.e., behave like `tail -f'.
179
180 Without --stream and with --pretty (either set or implied),
181 HTTPie fetches the whole response before it outputs the pro‐
182 cessed data.
183
184 Set this option when you want to continuously display a pretti‐
185 fied long-lived response, such as one from the Twitter streaming
186 API.
187
188 It is useful also without --pretty: It ensures that the output
189 is flushed more often and in smaller chunks.
190
191 --output FILE, -o FILE
192
193 Save output to FILE instead of stdout. If --download is also
194 set, then only the response body is saved to FILE. Other parts
195 of the HTTP exchange are printed to stderr.
196
197 --download, -d
198
199 Do not print the response body to stdout. Rather, download it
200 and store it in a file. The filename is guessed unless specified
201 with --output [filename]. This action is similar to the default
202 behaviour of wget.
203
204 --continue, -c
205
206 Resume an interrupted download. Note that the --output option
207 needs to be specified as well.
208
209 Sessions:
210 --session SESSION_NAME_OR_PATH
211
212 Create, or reuse and update a session. Within a session, custom
213 headers, auth credential, as well as any cookies sent by the
214 server persist between requests.
215
216 Session files are stored in:
217
218 /builddir/.httpie/sessions/<HOST>/<SESSION_NAME>.json.
219
220 --session-read-only SESSION_NAME_OR_PATH
221
222 Create or read a session without updating it form the
223 request/response exchange.
224
225 Authentication:
226 --auth USER[:PASS], -a USER[:PASS]
227
228 If only the username is provided (-a username), HTTPie will
229 prompt for the password.
230
231 --auth-type {basic,digest}, -A {basic,digest}
232
233 The authentication mechanism to be used. Defaults to "basic".
234
235 "basic": Basic HTTP auth "digest": Digest HTTP auth
236
237 Network:
238 --proxy PROTOCOL:PROXY_URL
239
240 String mapping protocol to the URL of the proxy (e.g.
241 http:http://foo.bar:3128). You can specify multiple proxies with
242 different protocols.
243
244 --follow, -F
245
246 Follow 30x Location redirects.
247
248 --max-redirects MAX_REDIRECTS
249
250 By default, requests have a limit of 30 redirects (works with
251 --follow).
252
253 --timeout SECONDS
254
255 The connection timeout of the request in seconds. The default
256 value is 30 seconds.
257
258 --check-status
259
260 By default, HTTPie exits with 0 when no network or other fatal
261 errors occur. This flag instructs HTTPie to also check the HTTP
262 status code and exit with an error if the status indicates one.
263
264 When the server replies with a 4xx (Client Error) or 5xx (Server
265 Error) status code, HTTPie exits with 4 or 5 respectively. If
266 the response is a 3xx (Redirect) and --follow hasn't been set,
267 then the exit status is 3. Also an error message is written to
268 stderr if stdout is redirected.
269
270 SSL:
271 --verify VERIFY
272
273 Set to "no" to skip checking the host's SSL certificate. You can
274 also pass the path to a CA_BUNDLE file for private certs. You
275 can also set the REQUESTS_CA_BUNDLE environment variable.
276 Defaults to "yes".
277
278 --ssl {ssl2.3,tls1,tls1.1,tls1.2}
279
280 The desired protocol version to use. This will default to SSL
281 v2.3 which will negotiate the highest protocol that both the
282 server and your installation of OpenSSL support. Available pro‐
283 tocols may vary depending on OpenSSL installation (only the sup‐
284 ported ones are shown here).
285
286 --cert CERT
287
288 You can specify a local cert to use as client side SSL certifi‐
289 cate. This file may either contain both private key and cer‐
290 tificate or you may specify --cert-key separately.
291
292 --cert-key CERT_KEY
293
294 The private key to use with SSL. Only needed if --cert is given
295 and the certificate file does not contain the private key.
296
297 Troubleshooting:
298 --ignore-stdin
299
300 Do not attempt to read stdin.
301
302 --help
303
304 Show this help message and exit.
305
306 --version
307
308 Show version and exit.
309
310 --traceback
311
312 Prints the exception traceback should one occur.
313
314 --debug
315
316 Prints the exception traceback should one occur, as well as
317 other information useful for debugging HTTPie itself and for
318 reporting bugs.
319
320 For every --OPTION there is also a --no-OPTION that reverts OPTION to
321 its default value.
322
323 Suggestions and bug reports are greatly appreciated:
324
325 https://github.com/jkbrzt/httpie/issues
326
328 The full documentation for http is maintained as a Texinfo manual. If
329 the info and http programs are properly installed at your site, the
330 command
331
332 info http
333
334 should give you access to the complete manual.
335
336
337
338http 0.9.4 July 2019 HTTP(1)