GUIDE深度 · Deep dive
Common cURL Flags
cURL defaults to GET; -X changes the method, -H adds headers, -d adds a body (default POST) and --url sets the address. Shell quoting defines argument boundaries; escape JSON quotes or wrap in single quotes.
Minimal examples
GET: curl https://api.example.com/items
POST JSON: curl -X POST -H 'Content-Type: application/json' -d '{"a":1}' URL
Debugging
-i shows response headers, -v shows handshake/request headers.
--data-raw prevents @ from being treated as a file.
FAQ
Why does -d become POST?
That is curl's default; add -G for GET.
Which quotes?
Wrap JSON in single quotes so inner double quotes need no escaping (bash).