Requests
Send a request with curl
Build GET and POST requests from the command line so you can control methods, headers, and bodies without a browser interface.
9 minute lesson
~~~
curl is an HTTP client you can run in a terminal.
Request a page and show response headers:
curl -i https://example.com/
Send JSON with POST:
curl https://example.com/notes \
-X POST \
-H 'Content-Type: application/json' \
-d '{"title":"Learn HTTP"}'
-X chooses the method, -H adds a header, and -d supplies a body. When you use -d, curl chooses POST by default, so -X POST is optional here.
Add -v for connection and request details. It is noisy, but useful when a redirect, TLS handshake, or request header is not behaving as expected.
Quick check
Result
You got of right.
Lesson completed