Aniruddha
Aniruddha

Reputation: 1039

URL issue while using cURL command

I'm running into issue while using curl to consume a webservice. There is URL which works fine if we consume using Postman but fails when consumed via cURL.

URL in Postman, which works fine:

https://localhost/WebService/InvokeEventRule?EventRuleName=S3Copy&EventParams=

Below is the cURL command, which fails and gives an error as 'EventParams is not recognized as an internal or external command'

curl -k -u testuser:Password0! --url https://localhost/WebService/InvokeEventRule?EventRuleName=S3Copy&EventParams=

Notice the ampersand (&) after S3Copy in URL, if I replace it with ?, cURL will not give the error as mentioned above but the I'll get a 'Bad Request' and of course replacing & with ? will fail in Postman too.

Could anybody advise why CURL is not accepting ampersand (&) but ? and anyway it's failing?

Upvotes: 0

Views: 1789

Answers (1)

Parithiban
Parithiban

Reputation: 1656

You need to wrap the url with quotes

curl --request GET 'https://api.github.com/repos/facebook/react/pulls?state=open&sort=updated'

NOTE: If you are using postman you can get the curl request sample by clicking on the code option in postman. It will generate your code in most of the programming language.

enter image description here

Upvotes: 2

Related Questions