Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

send multiple request parmeter in get request in curl, only single parameter is going

Tags:

unix

curl

get

I am trying to make a curl get request to my api through command line.

curl http://localhost:8080/getList?id=100&mrp=50&discount=0

But when I log the request in my api I get:

&{GET /getList?id=100 HTTP/1.1 1 1  which means that only id is being sent through the request. I don't understand why it is happening.
like image 240
Jagrati Avatar asked Dec 17 '25 21:12

Jagrati


1 Answers

When you run the curl command with multiple request parameters separated by &, unix treats the & as sign to execute the previous command in the background.Everthing else following it is treated as a separate command.

Wrap the url in quote while sending the request

curl "http://localhost:8080/getList?id=100&mrp=50&discount=0"
like image 172
Shubham Khatri Avatar answered Dec 20 '25 18:12

Shubham Khatri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!