Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Search key or summary

David Newcomnb April 22, 2015

I'm trying to create a drop down box in an application that allows the user to search for issues. The search query should only search JIRA keys and the summary. I'd like the results to come back in JSON, preferably.

I've been trying to find an API without success. I have found:

https://example.com/rest/api/1.0/issues/picker?query=abc which does everything I want but the result comes back in xml and not JSON.

I have also been looking through the version 2 which returns stuff in JSON but doesn't appear to have anything similar like in version 1.

So is there a JSON returning v2 API that searches the key and the title but doesn't return absolutely everything about the issue or is there a way to make the v1 API return JSON instead of XML.

 

 

 

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 30, 2015

Hello David,

Please, run the following REST API call:

# USERNAME, i.e.: myuser
# JIRA-BASE-URL, i.e.: http://my.jira.domain
# ISSUE-KEY, i.e.: ABC-1
# SUMMARY, i.e.: This is a sample
curl -u USERNAME -p -H "Content-Type: application/json" -X GET JIRA-BASE-URL/rest/api/2/search?jql=issuekey%3D"ISSUE-KEY"%20and%20summary~"SUMMARY"

In case you are running JIRA under HTTPS protocol, please run the cURL command as per following:

curl -D- -u USERNAME ...

In the above call, you will be prompted to type in the password to the "USERNAME" given, in this case the password for user "myuser". Alternatively, you could call as per following avoiding to be prompted for password:

curl -u [USERNAME]:[PASSWORD] -H "Content-Type: application/json" ...

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2015

Hi David!

Just had the same problem as you with /rest/api/1.0/issues/picker and googled your question. Forced it to return JSON by adding the "Accept" header to ajax request:

$.ajax({
  url : url,
  headers : {
    Accept: "application/json"
  },
  contentType : "application/json"
...

The "/rest/api/2/issue/picker" is available since JIRA v. 6.4 and hence "/rest/api/1.0/issues/picker" is NOT available. So you could need to check JIRA version to support JIRA before and after 6.4. 

0 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 22, 2015

Hello David,

Thank you for your question.

Please, refer to JIRA 6.4.2 REST API documentation as /rest/api/2/issue/picker will return JSON.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

David Newcomnb April 27, 2015

I was unable to get a single result back from this call. I tried looking for a project key partial and full (with /rest/api/2/issue/picker?query=PROJECT-nnn), I also tried a word from the summary (with /rest/api/2/issue/picker?query=my_free_text) but everything produced "Issue Does Not Exist" (in JSON). Currently can't accept this answer.

rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2015

Hello David, Please, visit the link URL provided as you will find extra parameters used to narrow the search down. Example: <jira-base-url>/rest/api/2/issue/picker?query=PROJECT&currentProjectId=PROJECT&currentIssueKey=PROJECT-3 — Kind regards, Rafael P. Sperafico Atlassian Support

David Newcomnb April 29, 2015

You have just cut and pasted the documentation, which I have read. It seems a bit pointless to have a search where you have to specify the project and jira-entry you are looking for in the search!!! Your example returns no results either. You try it: https://jira.atlassian.com/rest/api/2/issue/picker?query=problem&currentProjectId=JRA&currentIssueKey=JRA-28590 or https://jira.atlassian.com/rest/api/2/issue/picker?query=problem&currentProjectId=JRA or https://jira.atlassian.com/rest/api/2/issue/picker?query=problem

rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 29, 2015

Hello David, When running the call mentioned in this thread "/rest/api/2/issue/picker?query=foo", returns suggested issues which match the auto-completion query for the user which executes this request. This REST method will check the user's history and the user's browsing context and select this issues, which match the query. If "foo" is not mentioned in the "/issue/picker" the response to the call will not return what you expect. Could you please let me know what are you trying to search and get as response? — Kind regards, Rafael P. Sperafico Atlassian Support

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events