Sunday, January 28, 2024

[SOLVED] How to pass several parameters through curl in `get` request?

Issue

I execute a request of this kind: curl http://127.0.0.1:8000/api/v1/landing?param1=1&param2=2 As a result, I get only the first parameter. Why is this happening and how to fix it?


Solution

You must put the argument within quotes (double or single, depending on what you want and on what platform you use) so that the shell doesn't interpret the & letter.

Like this:

curl "http://127.0.0.1:8000/api/v1/landing?param1=1&param2=2"


Answered By - Daniel Stenberg
Answer Checked By - Marie Seifert (WPSolving Admin)