Skip to content

Tool Curl

Rajendra Prasad Reddy Penumalli edited this page Dec 12, 2019 · 5 revisions

Tool- Curl

  • Scripting : bash or shell scripting

  • Installing curl utility on Linux

curl flags
  • -c : cookie

  • -A : User Agant

  • -X : HTTP MEthod(GET/POST/PUT/DELETE)

  • -H : header

  • -d : data

  • -s : silent

  • -v : verbose

  • -o : output

  • Sending GET Request via Curl

    curl -X GET -H "Content-Type: application/json" "http://localhost:3000/employees"

  • Sending POST Request via Curl

    curl -X POST -H "Content-Type: application/json" -d '{"name": "Lisa","salary": "2000"}' "http://localhost:3000/employees"

  • Sending PUT Request via Curl

    curl -X PUT -H "Content-Type: application/json" -d '{"name": "Lisa", "salary": "8000"}' "http://localhost:3000/employees/3"

  • Sending DELETE Request via Curl

    curl -X DELETE -H "Content-Type: application/json" "http://localhost:3000/employees/2"

  • Saving cookies and Using in subsequent requests

    curl -c cookies.txt www.example.com

    Note: in abobe cookies will be saved into cookies.txt file

Clone this wiki locally