Getting IllegalArgumentException when I try to run JQL search rest api
Asked by Nallusamy Narayanaswamy:

Hi,

I am trying to get jira issue details from confluence and trying to run the below jql search api. it throws IllegalArgumentException.

[https://xyz/plugins/servlet/applinks/proxy?appId=xyz123\&path=https://abcdef/rest/api/2/search?jql=project=ATADMIN%20AND%20status=Done](https://xyz/plugins/servlet/applinks/proxy?appId=xyz123&path=https://abcdef/rest/api/2/search?jql=project=ATADMIN%20AND%20status=Done)

I think, the space in the query causing issue. jql=project=ATADIM AND status=Done.

Please suggest how to handle that space.


Answers:
author: Christof Hurst
body: The Url must be encoded correctly:

```
.../search?jql=project%20%3D%20ATADMIN%20AND%20status%20%3D%20Done
```

comments: author: Timothy Padgett
body: I'm facing the same problem, but encoding doesn't solve it. A simple JQL works, e.g.

* [https://confluence.mycompany.com/plugins/servlet/applinks/proxy?appId=APP_ID\&path=https://jira.mycompany.com/rest/api/latest/search?jql=project=PROJECT](https://confluence.mycompany.com/plugins/servlet/applinks/proxy?appId=APP_ID&path=https://jira.mycompany.com/rest/api/latest/search?jql=project=PROJECT)

but anything with whitespace fails, even when encoded:

* [https://confluence.mycompany.com/plugins/servlet/applinks/proxy?appId=APP_ID\&path=https://jira.mycompany.com/rest/api/latest/search?jql=project%20=%20MR](https://confluence.mycompany.com/plugins/servlet/applinks/proxy?appId=APP_ID&path=https://jira.mycompany.com/rest/api/latest/search?jql=project%20=%20MR)

The error is :

* *java.net.URISyntaxException: Illegal character in query at index 88: <https://jira.mycompany.com/https://jira.mycompany.com/rest/api/latest/search?jql=project> = MR*

The error is bizarre in that I'm not sure why the first part is repeated?


author: psabdulkader
body: Try by using jql parameters as the last parameter

Example *[https://jira.mycompany.com/https://jira.mycompany.com/rest/api/latest/search?fields=key\&jql=project](https://jira.mycompany.com/https://jira.mycompany.com/rest/api/latest/search?jql=project) = MR*


author: Fabian Lim
body: Hi [@Nallusamy Narayanaswamy](/t5/user/viewprofilepage/user-id/3739959)

Do you have more details on the error message?

Thanks

comments: author: Nallusamy Narayanaswamy
body: Hi [@Fabian Lim](/t5/user/viewprofilepage/user-id/3131564)

**Here is the full error**

### Cause {#toc-hId-1290445099}

java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in query at index 110: <https://athenajira.athenahealth.com/https://athenajira.athenahealth.com/rest/api/2/search?jql=project=INCIDENT> AND status=Done  
at com.atlassian.applinks.core.auth.ApplicationLinkRequestFactoryFactoryImpl$AbsoluteURLRequestFactory.createRequest(ApplicationLinkRequestFactoryFactoryImpl.java:191)

caused by: java.net.URISyntaxException: Illegal character in query at index 110: <https://athenajira.athenahealth.com/https://athenajira.athenahealth.com/rest/api/2/search?jql=project=INCIDENT> AND status=Done  
at java.base/java.net.URI$Parser.fail(Unknown Source)

#### Stack Trace:\[hide\] {#toc-hId-1981006573}

```
java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in query at index 110: https://athenajira.athenahealth.com/https://athenajira.athenahealth.com/rest/api/2/search?jql=project=INCIDENT AND status=Done at com.atlassian.applinks.core.auth.ApplicationLinkRequestFactoryFactoryImpl$AbsoluteURLRequestFactory.createRequest(ApplicationLinkRequestFactoryFactoryImpl.java:191) at com.atlassian.applinks.core.auth.ApplicationLinkAnalyticsRequestFactory.createRequest(ApplicationLinkAnalyticsRequestFactory.java:30) at com.atlassian.confluence.plugins.jira.AbstractProxyServlet.prepareRequest(AbstractProxyServlet.java:55) at com.atlassian.confluence.plugins.jira.AbstractProxyServlet.doProxy(AbstractProxyServlet.java:147) at com.atlassian.confluence.plugins.jira.AppLinksProxyRequestServlet.doProxy(AppLinksProxyRequestServlet.java:82) at com.atlassian.confluence.plugins.jira.AbstractProxyServlet.doGet(AbstractProxyServlet.java:87)
```


author: Timothy Padgett
body: Please see my details in a response to the above post, and let me know if there is anything else that I can provide to help you help me. tia


Tags: api

confluence-server

server