xref: /curl/docs/cmdline-opts/request.md (revision 6a7ad891)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: request
5Short: X
6Arg: <method>
7Help: Specify request method to use
8Category: connection
9Added: 6.0
10Multi: single
11See-also:
12  - request-target
13Example:
14  - -X "DELETE" $URL
15  - -X NLST ftp://example.com/
16---
17
18# `--request`
19
20Change the method to use when starting the transfer.
21
22curl passes on the verbatim string you give it in the request without any
23filter or other safe guards. That includes white space and control characters.
24
25## HTTP
26Specifies a custom request method to use when communicating with the HTTP
27server. The specified request method is used instead of the method otherwise
28used (which defaults to *GET*). Read the HTTP 1.1 specification for details
29and explanations. Common additional HTTP requests include *PUT* and *DELETE*,
30while related technologies like WebDAV offers *PROPFIND*, *COPY*, *MOVE* and
31more.
32
33Normally you do not need this option. All sorts of *GET*, *HEAD*, *POST* and
34*PUT* requests are rather invoked by using dedicated command line options.
35
36This option only changes the actual word used in the HTTP request, it does not
37alter the way curl behaves. For example if you want to make a proper HEAD
38request, using -X HEAD does not suffice. You need to use the --head option.
39
40The method string you set with --request is used for all requests, which
41if you for example use --location may cause unintended side-effects when curl
42does not change request method according to the HTTP 30x response codes - and
43similar.
44
45## FTP
46Specifies a custom FTP command to use instead of *LIST* when doing file lists
47with FTP.
48
49## POP3
50Specifies a custom POP3 command to use instead of *LIST* or *RETR*.
51(Added in 7.26.0)
52
53## IMAP
54Specifies a custom IMAP command to use instead of *LIST*. (Added in 7.30.0)
55
56## SMTP
57Specifies a custom SMTP command to use instead of *HELP* or **VRFY**. (Added in 7.34.0)
58