codekingpro/portable-devtools
114k
1.\" This file is auto-generated from the parser declaration in httpie/cli/definition.py by extras/scripts/generate_man_pages.py.2.TH http 1 "2024-07-10" "HTTPie 3.2.4" "HTTPie Manual"3.SH NAME4http5.SH SYNOPSIS6http [METHOD] URL [REQUEST_ITEM ...]7 8.SH DESCRIPTION9HTTPie: modern, user-friendly command-line HTTP client for the API era. <https://httpie.io>10.SH Positional arguments11 12These arguments come after any flags and in the order they are listed here.13Only URL is required.14 15.IP "\fB\,METHOD\/\fR"16 17 18The HTTP method to be used for the request (GET, POST, PUT, DELETE, ...).19 20This argument can be omitted in which case HTTPie will use POST if there21is some data to be sent, otherwise GET:22 23 $ http example.org # => GET24 $ http example.org hello=world # => POST25 26 27 28.IP "\fB\,URL\/\fR"29 30 31The request URL. Scheme defaults to \[aq]http://\[aq] if the URL32does not include one. (You can override this with: \fB\,--default-scheme\/\fR=http/https)33 34You can also use a shorthand for localhost35 36 $ http :3000 # => http://localhost:300037 $ http :/foo # => http://localhost/foo38 39 40 41.IP "\fB\,REQUEST_ITEM\/\fR"42 43 44Optional key-value pairs to be included in the request. The separator used45determines the type:46 47\[aq]:\[aq] HTTP headers:48 49 Referer:https://httpie.io Cookie:foo=bar User-Agent:bacon/1.050 51\[aq]==\[aq] URL parameters to be appended to the request URI:52 53 search==httpie54 55\[aq]=\[aq] Data fields to be serialized into a JSON object (with \fB\,--json\/\fR, \fB\,-j\/\fR)56 or form data (with \fB\,--form\/\fR, \fB\,-f\/\fR):57 58 name=HTTPie language=Python description=\[aq]CLI HTTP client\[aq]59 60\[aq]:=\[aq] Non-string JSON data fields (only with \fB\,--json\/\fR, \fB\,-j\/\fR):61 62 awesome:=true amount:=42 colors:=\[aq][\[dq]red\[dq], \[dq]green\[dq], \[dq]blue\[dq]]\[aq]63 64\[aq]@\[aq] Form file fields (only with \fB\,--form\/\fR or \fB\,--multipart\/\fR):65 66 cv@\(ti/Documents/CV.pdf67 cv@\[aq]\(ti/Documents/CV.pdf;type=application/pdf\[aq]68 69\[aq]=@\[aq] A data field like \[aq]=\[aq], but takes a file path and embeds its content:70 71 essay=@Documents/essay.txt72 73\[aq]:=@\[aq] A raw JSON field like \[aq]:=\[aq], but takes a file path and embeds its content:74 75 package:=@./package.json76 77You can use a backslash to escape a colliding separator in the field name:78 79 field-name-with\e:colon=value80 81 82 83.PP84.SH Predefined content types85.IP "\fB\,--json\/\fR, \fB\,-j\/\fR"86 87 88(default) Data items from the command line are serialized as a JSON object.89The Content-Type and Accept headers are set to application/json90(if not specified).91 92 93 94.IP "\fB\,--form\/\fR, \fB\,-f\/\fR"95 96 97Data items from the command line are serialized as form fields.98 99The Content-Type is set to application/x-www-form-urlencoded (if not100specified). The presence of any file fields results in a101multipart/form-data request.102 103 104 105.IP "\fB\,--multipart\/\fR"106 107 108Similar to \fB\,--form\/\fR, but always sends a multipart/form-data request (i.e., even without files).109 110 111.IP "\fB\,--boundary\/\fR"112 113 114Specify a custom boundary string for multipart/form-data requests. Only has effect only together with \fB\,--form\/\fR.115 116 117.IP "\fB\,--raw\/\fR"118 119 120This option allows you to pass raw request data without extra processing121(as opposed to the structured request items syntax):122 123 $ http \fB\,--raw\/\fR=\[aq]data\[aq] pie.dev/post124 125You can achieve the same by piping the data via stdin:126 127 $ echo data | http pie.dev/post128 129Or have HTTPie load the raw data from a file:130 131 $ http pie.dev/post @data.txt132 133 134 135 136.PP137.SH Content processing options138.IP "\fB\,--compress\/\fR, \fB\,-x\/\fR"139 140 141Content compressed (encoded) with Deflate algorithm.142The Content-Encoding header is set to deflate.143 144Compression is skipped if it appears that compression ratio is145negative. Compression can be forced by repeating the argument.146 147 148 149.PP150.SH Output processing151.IP "\fB\,--pretty\/\fR"152 153 154Controls output processing. The value can be \[dq]none\[dq] to not prettify155the output (default for redirected output), \[dq]all\[dq] to apply both colors156and formatting (default for terminal output), \[dq]colors\[dq], or \[dq]format\[dq].157 158 159 160.IP "\fB\,--style\/\fR, \fB\,-s\/\fR \fI\,STYLE\/\fR"161 162 163Output coloring style (default is \[dq]auto\[dq]). It can be one of:164 165 auto, pie, pie-dark, pie-light, solarized166 167 168For finding out all available styles in your system, try:169 170$ http \fB\,--style\/\fR171 172The \[dq]auto\[dq] style follows your terminal\[aq]s ANSI color styles.173For non-auto styles to work properly, please make sure that the174$TERM environment variable is set to \[dq]xterm-256color\[dq] or similar175(e.g., via `export TERM=xterm-256color\[aq] in your \(ti/.bashrc).176 177.IP "\fB\,--unsorted\/\fR"178 179 180Disables all sorting while formatting output. It is a shortcut for:181 182 \fB\,--format-options\/\fR=headers.sort:false,json.sort_keys:false183 184 185 186.IP "\fB\,--sorted\/\fR"187 188 189Re-enables all sorting options while formatting output. It is a shortcut for:190 191 \fB\,--format-options\/\fR=headers.sort:true,json.sort_keys:true192 193 194 195.IP "\fB\,--response-charset\/\fR \fI\,ENCODING\/\fR"196 197 198Override the response encoding for terminal display purposes, e.g.:199 200 \fB\,--response-charset\/\fR=utf8201 \fB\,--response-charset\/\fR=big5202 203 204 205.IP "\fB\,--response-mime\/\fR \fI\,MIME_TYPE\/\fR"206 207 208Override the response mime type for coloring and formatting for the terminal, e.g.:209 210 \fB\,--response-mime\/\fR=application/json211 \fB\,--response-mime\/\fR=text/xml212 213 214 215.IP "\fB\,--format-options\/\fR"216 217 218Controls output formatting. Only relevant when formatting is enabled219through (explicit or implied) \fB\,--pretty\/\fR=all or \fB\,--pretty\/\fR=format.220The following are the default options:221 222 headers.sort:true223 json.format:true224 json.indent:4225 json.sort_keys:true226 xml.format:true227 xml.indent:2228 229You may use this option multiple times, as well as specify multiple230comma-separated options at the same time. For example, this modifies the231settings to disable the sorting of JSON keys, and sets the indent size to 2:232 233 \fB\,--format-options\/\fR json.sort_keys:false,json.indent:2234 235This is something you will typically put into your config file.236 237 238 239.PP240.SH Output options241.IP "\fB\,--print\/\fR, \fB\,-p\/\fR \fI\,WHAT\/\fR"242 243 244String specifying what the output should contain:245 246 \[aq]H\[aq] request headers247 \[aq]B\[aq] request body248 \[aq]h\[aq] response headers249 \[aq]b\[aq] response body250 \[aq]m\[aq] response metadata251 252The default behaviour is \[aq]hb\[aq] (i.e., the response253headers and body is printed), if standard output is not redirected.254If the output is piped to another program or to a file, then only the255response body is printed by default.256 257 258 259.IP "\fB\,--headers\/\fR, \fB\,-h\/\fR"260 261 262Print only the response headers. Shortcut for \fB\,--print\/\fR=h.263 264 265 266.IP "\fB\,--meta\/\fR, \fB\,-m\/\fR"267 268 269Print only the response metadata. Shortcut for \fB\,--print\/\fR=m.270 271 272 273.IP "\fB\,--body\/\fR, \fB\,-b\/\fR"274 275 276Print only the response body. Shortcut for \fB\,--print\/\fR=b.277 278 279 280.IP "\fB\,--verbose\/\fR, \fB\,-v\/\fR"281 282 283Verbose output. For the level one (with single `\fB\,-v\/\fR`/`\fB\,--verbose\/\fR`), print284the whole request as well as the response. Also print any intermediary285requests/responses (such as redirects). For the second level and higher,286print these as well as the response metadata.287 288Level one is a shortcut for: \fB\,--all\/\fR \fB\,--print\/\fR=BHbh289Level two is a shortcut for: \fB\,--all\/\fR \fB\,--print\/\fR=BHbhm290 291 292.IP "\fB\,--all\/\fR"293 294 295By default, only the final request/response is shown. Use this flag to show296any intermediary requests/responses as well. Intermediary requests include297followed redirects (with \fB\,--follow\/\fR), the first unauthorized request when298Digest auth is used (\fB\,--auth\/\fR=digest), etc.299 300 301 302.IP "\fB\,--stream\/\fR, \fB\,-S\/\fR"303 304 305Always stream the response body by line, i.e., behave like `tail \fB\,-f\/\fR\[aq].306 307Without \fB\,--stream\/\fR and with \fB\,--pretty\/\fR (either set or implied),308HTTPie fetches the whole response before it outputs the processed data.309 310Set this option when you want to continuously display a prettified311long-lived response, such as one from the Twitter streaming API.312 313It is useful also without \fB\,--pretty\/\fR: It ensures that the output is flushed314more often and in smaller chunks.315 316 317 318.IP "\fB\,--output\/\fR, \fB\,-o\/\fR \fI\,FILE\/\fR"319 320 321Save output to FILE instead of stdout. If \fB\,--download\/\fR is also set, then only322the response body is saved to FILE. Other parts of the HTTP exchange are323printed to stderr.324 325 326 327.IP "\fB\,--download\/\fR, \fB\,-d\/\fR"328 329 330Do not print the response body to stdout. Rather, download it and store it331in a file. The filename is guessed unless specified with \fB\,--output\/\fR332[filename]. This action is similar to the default behaviour of wget.333 334 335 336.IP "\fB\,--continue\/\fR, \fB\,-c\/\fR"337 338 339Resume an interrupted download. Note that the \fB\,--output\/\fR option needs to be340specified as well.341 342 343 344.IP "\fB\,--quiet\/\fR, \fB\,-q\/\fR"345 346 347Do not print to stdout or stderr, except for errors and warnings when provided once.348Provide twice to suppress warnings as well.349stdout is still redirected if \fB\,--output\/\fR is specified.350Flag doesn\[aq]t affect behaviour of download beyond not printing to terminal.351 352 353 354.PP355.SH Sessions356.IP "\fB\,--session\/\fR \fI\,SESSION_NAME_OR_PATH\/\fR"357 358 359Create, or reuse and update a session. Within a session, custom headers,360auth credential, as well as any cookies sent by the server persist between361requests.362 363Session files are stored in:364 365 [HTTPIE_CONFIG_DIR]/<HOST>/<SESSION_NAME>.json.366 367See the following page to find out your default HTTPIE_CONFIG_DIR:368 369 https://httpie.io/docs/cli/config-file-directory370 371 372.IP "\fB\,--session-read-only\/\fR \fI\,SESSION_NAME_OR_PATH\/\fR"373 374 375Create or read a session without updating it form the request/response376exchange.377 378 379 380.PP381.SH Authentication382.IP "\fB\,--auth\/\fR, \fB\,-a\/\fR \fI\,USER[:PASS] | TOKEN\/\fR"383 384 385For username/password based authentication mechanisms (e.g386basic auth or digest auth) if only the username is provided387(\fB\,-a\/\fR username), HTTPie will prompt for the password.388 389 390 391.IP "\fB\,--auth-type\/\fR, \fB\,-A\/\fR"392 393 394The authentication mechanism to be used. Defaults to \[dq]basic\[dq].395 396\[dq]basic\[dq]: Basic HTTP auth397 398\[dq]digest\[dq]: Digest HTTP auth399 400\[dq]bearer\[dq]: Bearer HTTP Auth401 402To see all available auth types on your system, including ones installed via plugins, run:403 404$ http \fB\,--auth-type\/\fR405 406.IP "\fB\,--ignore-netrc\/\fR"407 408 409Ignore credentials from .netrc.410 411 412.PP413.SH Network414.IP "\fB\,--offline\/\fR"415 416 417Build the request and print it but don\(gat actually send it.418 419 420.IP "\fB\,--proxy\/\fR \fI\,PROTOCOL:PROXY_URL\/\fR"421 422 423String mapping protocol to the URL of the proxy424(e.g. http:http://foo.bar:3128). You can specify multiple proxies with425different protocols. The environment variables $ALL_PROXY, $HTTP_PROXY,426and $HTTPS_proxy are supported as well.427 428 429 430.IP "\fB\,--follow\/\fR, \fB\,-F\/\fR"431 432 433Follow 30x Location redirects.434 435 436.IP "\fB\,--max-redirects\/\fR"437 438 439By default, requests have a limit of 30 redirects (works with \fB\,--follow\/\fR).440 441 442 443.IP "\fB\,--max-headers\/\fR"444 445 446The maximum number of response headers to be read before giving up (default 0, i.e., no limit).447 448 449.IP "\fB\,--timeout\/\fR \fI\,SECONDS\/\fR"450 451 452The connection timeout of the request in seconds.453The default value is 0, i.e., there is no timeout limit.454This is not a time limit on the entire response download;455rather, an error is reported if the server has not issued a response for456timeout seconds (more precisely, if no bytes have been received on457the underlying socket for timeout seconds).458 459 460 461.IP "\fB\,--check-status\/\fR"462 463 464By default, HTTPie exits with 0 when no network or other fatal errors465occur. This flag instructs HTTPie to also check the HTTP status code and466exit with an error if the status indicates one.467 468When the server replies with a 4xx (Client Error) or 5xx (Server Error)469status code, HTTPie exits with 4 or 5 respectively. If the response is a4703xx (Redirect) and \fB\,--follow\/\fR hasn\[aq]t been set, then the exit status is 3.471Also an error message is written to stderr if stdout is redirected.472 473 474 475.IP "\fB\,--path-as-is\/\fR"476 477 478Bypass dot segment (/../ or /./) URL squashing.479 480 481.IP "\fB\,--chunked\/\fR"482 483 484Enable streaming via chunked transfer encoding. The Transfer-Encoding header is set to chunked.485 486 487.PP488.SH SSL489.IP "\fB\,--verify\/\fR"490 491 492Set to \[dq]no\[dq] (or \[dq]false\[dq]) to skip checking the host\[aq]s SSL certificate.493Defaults to \[dq]yes\[dq] (\[dq]true\[dq]). You can also pass the path to a CA_BUNDLE file494for private certs. (Or you can set the REQUESTS_CA_BUNDLE environment495variable instead.)496 497 498.IP "\fB\,--ssl\/\fR"499 500 501The desired protocol version to use. This will default to502SSL v2.3 which will negotiate the highest protocol that both503the server and your installation of OpenSSL support. Available protocols504may vary depending on OpenSSL installation (only the supported ones505are shown here).506 507 508 509.IP "\fB\,--ciphers\/\fR"510 511 512 513A string in the OpenSSL cipher list format.514 515 516See `http \fB\,--help\/\fR` for the default ciphers list on you system.517 518 519 520 521 522.IP "\fB\,--cert\/\fR"523 524 525You can specify a local cert to use as client side SSL certificate.526This file may either contain both private key and certificate or you may527specify \fB\,--cert-key\/\fR separately.528 529 530 531.IP "\fB\,--cert-key\/\fR"532 533 534The private key to use with SSL. Only needed if \fB\,--cert\/\fR is given and the535certificate file does not contain the private key.536 537 538 539.IP "\fB\,--cert-key-pass\/\fR"540 541 542The passphrase to be used to with the given private key. Only needed if \fB\,--cert-key\/\fR543is given and the key file requires a passphrase.544If not provided, you\(gall be prompted interactively.545 546 547.PP548.SH Troubleshooting549.IP "\fB\,--ignore-stdin\/\fR, \fB\,-I\/\fR"550 551 552Do not attempt to read stdin553 554 555.IP "\fB\,--help\/\fR"556 557 558Show this help message and exit.559 560 561.IP "\fB\,--manual\/\fR"562 563 564Show the full manual.565 566 567.IP "\fB\,--version\/\fR"568 569 570Show version and exit.571 572 573.IP "\fB\,--traceback\/\fR"574 575 576Prints the exception traceback should one occur.577 578 579.IP "\fB\,--default-scheme\/\fR"580 581 582The default scheme to use if not specified in the URL.583 584 585.IP "\fB\,--debug\/\fR"586 587 588Prints the exception traceback should one occur, as well as other589information useful for debugging HTTPie itself and for reporting bugs.590 591 592 593.PP594.SH SEE ALSO595 596For every \fB\,--OPTION\/\fR there is also a \fB\,--no-OPTION\/\fR that reverts OPTION597to its default value.598 599Suggestions and bug reports are greatly appreciated:600https://github.com/httpie/cli/issues