24 December 2020

curl cheat sheet

 Curl, the wget with steroids. https://curl.se/

1. response headers

curl -I http://localhost:8081/customers

HTTP/1.1 302
Set-Cookie: KC_REDIRECT=/customers; Path=/; HttpOnly
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Location: http://localhost:8081/sso/login
Transfer-Encoding: chunked
Date: Sun, 27 Dec 2020 15:38:57 GMT

2.  gzip call

curl -v -H "Content-Type: application/json" -H "Accept-Encoding: gzip" -I 

Content-Encoding: gzip
Content-Type: application/json

curl -v -H "Content-Type: application/json" -H "Accept-Encoding: gzip" -o four.json.gz

curl -v --compressed

3.  curl post

curl -k --max-time 30 -X GET ''
 --request GET

4. body:

curl -k --request POST '' --header 'Content-Type: application/json' --data-raw '{"user":{"user":"testuser","password":"welcome1","request-channel":1},"client-ID":"12345"}'

-d '{"query":{"match_all":{}}}'
-d, --data <data>

5. ssl


curl --cacert cacert.pem https://self-signed.badssl.com

6. cookie

--cookie "jsessionid=123"

7. timeout

--max-time 30

8. header

curl -H "Authorization: Basic YXBpdXNlcjphcGlwd2Q=" http://devweb.cl/status

9.  basic user?

--basic --user "redemption-br:GUkboMIZ"

No comments :

My Blog List

Blog Archive


The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.