Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JQL with Key filed in filter

Bharathiraja S August 1, 2018

Hello, I am making following REST API call to my JIRA instance.
Am getting the total result as 1, but am not getting any values inside the issues : [ ]

JQL:
http://myjira:8080/rest/api/2/search?startAt=1&maxResults=50&fields=project,status&jql=fields project status jql project=C00195 and key=C00195-2210

But I'm getting an error response:

{"startAt":1,"maxResults":50,"total":1,"issues":[]}

Above JQL is not working in browser as well.

If we remove the key filter then it was working as expected.

Working JQL:
http://myjira:8080/rest/api/2/search?startAt=1&maxResults=50&jql=project=C00095
 

Response:

{"expand":"schema,names","startAt":1,"maxResults":50,"total":2175,"issues":[{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"12560","self":"http://myjira:8080/rest/api/2/issue/12560","key":"C00095-2215","fields":{"parent":{"id":"12559","key":"C00095-2214","self":"http://myjira:8080/rest/api/2/issue/12559","fields":{"summary":"Task for tagging testing","status":

 

1 answer

1 accepted

1 vote
Answer accepted
Tansu Akdeniz
Community Champion
August 1, 2018

Hi @Bharathiraja S

I actually couldn't understand the first URL but it seems that you give an issue key (key=C00195-2210) in JQL? So, it will return a single issue as expected.

But for the second one, it returns all issues within a project as you give "project = C00095" in JQL.

Bharathiraja S August 1, 2018

Hi @Tansu Akdeniz,
Here key=C00195-2210, is the issueid or key.

I need to get status of particular issue in jira.

 

Thanks!
Bharathi

Tansu Akdeniz
Community Champion
August 1, 2018

You can use the following URL;

  • JIRA_BASE_URL/rest/api/2/issue/C00195-2210

It is better to get data with that one (more efficient way)

  • JIRA_BASE_URL/rest/api/2/issue/C00195-2210?fields=status
Tansu Akdeniz
Community Champion
August 1, 2018

Btw, if you want to get a query issues (JQL), use that one;

  • JIRA_BASE_URL/rest/api/2/search?jql=project=C00095&fields=status
Bharathiraja S August 1, 2018

Thank you @Tansu Akdeniz!

Given solution is working!

Just curious to know why below search query is not working?

JIRA_BASE_URL/rest/api/2/search?&fields=project,status&jql=key='C00195-2210'

Tansu Akdeniz
Community Champion
August 1, 2018

You are welcome @Bharathiraja S.

Actually, it seems same if I don't miss anything. Would you please mark as "Answered" (big grey tick mark to the left of the answer). So that, other people will be able to find this answer easily for similar questions.

Bharathiraja S August 1, 2018

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events