Hello,
I am trying to run a jql query using rest with java to get all issues from project "RO" and in a status I give as a parameter.
When I give a status without spaces everything works great, but when I give status with spaces (like In Review) i get:
Server returned HTTP response code: 400 for URL: http://myServer:8080/rest/api/2/search?jql=project%20%3D%20RO%20AND%20status%20%3D%20In+Review
seems like its a encoding problem, it doesn't encode the space right, i also tried %22 and it didn't work.
here is a part of the code:
String encoded = URLEncoder.encode("project = "+project+" AND status = " + status);
status = URLEncoder.encode(status,"UTF-8");
URL url = new URL(BASE_URL + "search?jql=project%20%3D%20"+project+"%20AND%20status%20%3D%20" + status);
How can I encode it correctly?
Community moderators have prevented the ability to post new answers.
Hi,
If I just look at the URL, I see it lacks the quotes (") around the status. So it should be something like this:
http://myServer:8080/rest/api/2/search?jql=project%20%3D%20RO%20AND%20status%20%3D%20"In%20Review"
You can use the issue navigator to see how the query is encoded in your case.
BTW I noticed you have In+Review instead of In%20Review, both seem to work when surrounded with quotes. The %20 version is what you see in the issue navigator.
Regards,
Geert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.