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