1

Very basic question about curl:

I can successfully pass a string parameter to the application exposing REST API on localhost with:

curl -d "stringParam = a b c d" 'localhost:8080/jobs?appName=testApp'

How would I compose regular URL that can be entered in a browser? I've tried:

localhost:8080/jobs?appName=testApp&stringParam="a b c d"

, but it doesn't work.

0

1 Answer 1

2

With cURL, when you use the -d switch, it will automatically turn it in to a POST request with the data (-d) as the entity body. What you are trying to do with the browser is send it in the URL (via implicit GET), which is not the same. In the the URL, it is a query parameter. What you are doing in the browser is the same as if you were to send the cURL request to that same URL (as you are with the Browser), without the -d switch. That will send a default GET, just like the browser.

If you want to do browser work, I'd suggest installing a browser extenstion, like Postman for Chrome or Rest Client for Firefox, or Advanced Rest Client for Chrome. There you can POST data to your REST services.

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

Comments

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.