Networking

curl

Transfer data from or to a server.

#networking #http #api

GET Request

Fetch the content of a URL.

curl [url]

POST Request

Send data using POST.

curl -X POST -d "param1=value1&param2=value2" [url]

Send JSON data.

curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' [url]

Headers

Add a custom header.

curl -H "[header]" [url]

Save to File

Save the output to a file.

curl -o output.file [url]

Save with the remote filename.

curl -O [url]

Follow Redirects

Follow HTTP redirects.

curl -L [url]

Verbose Mode

Show detailed information about the request and response.

curl -v [url]

Basic Auth

Use Basic Authentication.

curl -u username:password [url]

Insecure

Skip SSL certificate verification.

curl -k [url]