0

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?

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

4 Comments

Your kind help is very very much appreciated. Your solution has worked for me, many thanks!
Please don't use --request GET when it would already use GET...
I believe GET is required, because when not used, I get an error as curl: no URL specified!
For the above question, I generated the code from the postman. Actually you can use without a request curl -X GET 'https://api.github.com/repos/facebook/react/pulls?state=open&sort=updated'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.