Your cart is currently empty!
Curl: GET and POST Request
GET Request
To call a GET request to localhost:8080/path
curl localhost:8080/path
GET Request with Parameter Query
To call a GET request to localhost:8080/path?param1&value1¶m2=value2
curl -G localhost:8080/path -d param1=value1 -d param2=value2 curl -G localhost:8080/path -d param1="value1" -d param2="value2" curl -G localhost:8080/path -d "param1=value1" -d "param2=value2" curl -G localhost:8080/path -d "param1=value1¶m2=value2" curl "localhost:8080/path?param1=value1¶m2=value2"
Use wget:
wget localhost:8080/path wget localhost:8080/path?param1=value1 # If there are more than one query parameter, enclose with double quotes wget "localhost:8080/path?param1=value1¶m2=value2"
POST Request (application/x-www-form-urlencoded)
To call a POST request to localhost:8080/path
curl localhost:8080/path -d name1=value1 -d name2=value2 curl localhost:8080/path -d name1="value1" -d name2="value2" curl localhost:8080/path -d "name1=value1" -d "name2=value2" curl localhost:8080/path -d "name1=value1&name2=value2"
POST Request with Query Parameters
curl "localhost:8080/path?param1=pvalue1¶m2=pvalue2"
POST Request (multipart/form-data)
To call a POST request to localhost:8080/path
curl localhost:8080/path -F name1=value1 -F name2=value2 curl localhost:8080/path -F name1="value1" -F name2="value2" curl localhost:8080/path -F "name1=value1" -F "name2=value2"
Leave a Reply