Hi Experts,
Kindly correct my REST api calls. I just want to get all the issues by project key and issue type(filter). I tried but it is not working. please, someone, help me to correct this REST api call.
REST API:
Hi Experts,
Kindly correct my REST api calls. I just want to get all the issues by project key and issue type(filter). I tried but it is not working. please, someone, help me to correct this REST api call.
REST API:
Have you tried this using the postman collection from the Jira cloud rest API? https://developer.atlassian.com/cloud/jira/platform/rest/#introduction
The JQL you want is probably âproject=UC AND issuetype=Testâ.
The expand parameter value should probably be âprojects,issuetypes,fieldsâ.
Donât forget to URL-encode your query string parameters.
`http://server/rest/api/2/search?jql=project%3DUC%20AND%20issuetype%3DTest&expand=projects%2Cissuetypes%2Cfields&startAt=0&maxResults=500`
What if the issue type name has space inside ?
For example:
issuetypeName=Test Something
@Cri,
You can try %20 for space in query parameter.
@dchouksey89, doing so is interpreting it as been a next param called âSomethingâ which dosenât exist oviously.
@Cri . Hello and welcome to the Atlassian Developer Community
Given that there is no such searchable field called âissuetypeNameâ, nobody really cares if it does or doesnât have a space in it.
I do have a custom issue type name that has spaces. this is why I asked
You are confusing what you have provided as the name for a particular type of issue with a thing you think exists and is called âissuetypeNameâ that you think contains that piece of data. Jira has no field called âissuetypeNameâ that contains that data, because the data is stored in the field called âissuetypeâ.
For example, the issue of the type named Story has the name âStoryâ, just the same as the issue of type named My issue type is named âMy issue typeâ.
If you would have tried doing a JQL search for "âproject = âBPTâ AND issuetypeName = âMy issue typeââ Jira would have given you the following message:
Field âissuetypeNameâ does not exist or you do not have permission to view it.
A simple way to find out what fields exists and can be used as JQL search parameters is to use the Issue Search window, and the drop-down list that appears when you type in the word âissueâ will show you all the fields that start with that word:

@anon96974232 my bad, I meant to refer to âissuetypeâ.
So this is working for me just fine:
âhttps://server/rest/api/2/search?jql=project%3DTest%20AND%20issuetype%3DBugâ
But having an issuetype with spaces dose not:
âhttps://server/rest/api/2/search?jql=project%3DTest%20AND%20issuetype%3DTest%20Somethingâ
âerrorMessagesâ: Error in the JQL Query: Expecting either âORâ or âANDâ but got âSomethingâ
You just have a mal-formed JQL request. If you refer to the Jira JQL documentation and my example shown in the prior post, youâll see that when you specify a value for a field, and that value contains a space, then you need to enclose the value in quotation marks, like this:
https://server/rest/api/2/search?jql=project = Test AND issuetype = âTest Somethingâ
With URL escape codes for the equals signs, that would be:
https://server/rest/api/2/search?jql=project %3D Test AND issuetype %3D âTest Somethingâ
And if you want to omit the spaces before and after the equals signs, it would be:
https://server/rest/api/2/search?jql=project%3DTest AND issuetype%3D"Test Something"
and, lastly, if you wanted to encode the spaces, it would be:
https://server/rest/api/2/search?jql=project%3DTest%20AND%20issuetype%3D"Test%20Something"
The easiest way to get familiar with JQL, as a URL, is to go to the Issue Search page in the Jira project, change to Advanced Searching, construct the search you want, click the âSwitch to JQLâ button, then you will see the full JQL statement, as well as the URL equivalent:
Personally, when I build JQL requests, I always enclose all the text values in double quotes, whether they need them or not, as it is easier to use the same method all the time, not have a different method just for when values have spaces in them.
curl -D- -u user:pass -X GET -H âContent-Type: application/jsonâ âhttps://server/rest/api/2/search?jql=project%3DTest%20AND%20issuetype%3D"Test%20Something"â
âerrorMessagesâ: Error in the JQL Query: Expecting either âORâ or âANDâ but got âSomethingâ
Those two approaches worked for me:
curl -D- -u user:pass -X GET -H âContent-Type: application/jsonâ âhttps://server/rest/api/2/search?jql=project%3DTest%20AND%20issuetype%3DâTest%20Somethingââ
curl -D- -u user:pass -X GET -H âContent-Type: application/jsonâ -G âhttps://server/rest/api/2/searchâ --data-urlencode âjql=project=Test AND issuetype=âTest Somethingââ
The reason that first request didnât work was because you havenât escaped the double quotation marks within curlâs URL declaration by using backslashes.
Do a Google search for âcurl url escape double quotation marksâ for the many hundreds of articles that describe that.