Parameter value with space in CURL command gives 404 error

1.8k Views Asked by At

I am using jersey to create restful webservices. While using curl to consume webservices with parameter values with white space, I get 404 not found issue. What should be done to mitigate this problem.

Request

curl -X GET http://api.local.com:8080/v2/parameters**/parameter1/hello world world** /parameter2/world

Response HTTP Status 404 - Not Found

2

There are 2 best solutions below

0
On

URL encode the string before passing it, (I have not used jersey before so I can not aid it how to do this).

0
On

Use double quote(") around your URL as you have space in it. Also by default its GET request. So remove the -X GET

curl "http://api.local.com:8080/v2/parameters**/parameter1/hello world world** /parameter2/world"