Resources
Basis
Basis
curl http://my.url
Get HTTP Content.
Flags
-s
Silent (do not print curl info).-i
Show response Headers.
-L
Follow redirections.
-k
Ignore HTTPS Errors.--tls-max 1.2
Set the maximum TLS version.
-u admin:admin
Basic Auth (Authorization: Basicheader).
-H 'myHeader: myValue'
Set Header.
-X POST
Specifies method.-d
POST data.
-o myFile
Save response in a file.
Examples
GET current IPv4
curl -4 https://ifconfig.me
Return current public IPv4 (-4force using IPv4 for hostname resolution).
GET request with JWT
curl 'http://[TARGET_HOST]/api/book/1' \
-H 'Authorization: Bearer [JWT_TOKEN]'
Example GET request with JWT.
POST request with JSON content
curl 'http://[TARGET_HOST]/api/auth/login' \
-X POST \
-H "Content-Type: application/json" \
-d '{"username":"User","password":"P@ssw0rd"}'
Example POST request with JSON content.
