cURL Cheat Sheet
# cURL Cheat Sheet
## Basic
```
curl https://api.example.com
curl -o file.txt https://example.com/file
```
## Methods
```
curl -X POST https://api.example.com
curl -X PUT https://api.example.com
curl -X DELETE https://api.example.com
```
## Headers
```
curl -H "Content-Type: application/json" https://api.example.com
curl -H "Authorization: Bearer TOKEN" https://api.example.com
```
## Data
```
curl -d '{"key":"value"}' https://api.example.com
curl -d @data.json https://api.example.com
curl -F "[email protected]" https://upload.example.com
```
## Auth
```
curl -u user:pass https://api.example.com
curl --oauth2-bearer TOKEN https://api.example.com
```
## Debug
```
curl -v https://api.example.com # Verbose
curl -i https://api.example.com # Show headers
curl -w "%{http_code}" -o /dev/null -s https://api.example.com
```
## Common Flags
- -s โ Silent mode
- -L โ Follow redirects
- -k โ Allow insecure SSL
- -A "UA" โ User-Agent
- --connect-timeout 5 โ Connection timeout