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