$ curl [arguments] 'https://my.url.com/path/file.ext?a=b&c=d'
| Nickname |
Argument |
Description |
| Insecure |
-k |
Accept invalid TLS server certificates |
| Verb/Method |
-X POST |
Set the request verb |
| Header |
-H "Content-Type: application/json" |
Add a request header |
| Auth |
-u username:password |
Send authentication |
| Body |
-d "<hello />" |
Set the request body to a string |
| Body |
-T requestBody.xml |
Set the request body to a local file's contents |
| Nickname |
Argument |
Description |
| Verbose |
-v |
Show verbose output, including TLS, keepalive, and all headers |
| Quiet |
-s |
Hide all output except the response body |
| Headers |
-i |
Show response headers |
| Redirections |
-L |
Follow redirection responses |
| Output |
-o response.txt
-O |
Save the response to a local file instead of printing to standard output |
Remember to either escape all instances of & in the URL into \&, or surround the URL with 'single quotation marks', because otherwise Bash will assume you want to background the command before the ampersand and then run the right side as a separate command, instead of treating the entire URL as one string.