Missed Team ’24? Catch up on announcements here.

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

Exact matches with JQL in REST API

Dickson April 20, 2015

So I'm trying to do something such as look up an account that has the exact summary of "chihuahua", and my URL so far looks like http://jiraexample.com/rest/api/2/search?jql=project=ACCT&summary~chihuahua

I'm getting a list of a lot of results, when there should only be 1 exact match. Even surrounding the chihuahua in quotes doesn't work.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Andreas Ebert
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.
April 20, 2015

I think the problem might be the "&" in your URL. (And maybe also the "="s.) If those characters are not properly escaped, they are treated literally, and in URLs that means as parameter separators. If that is the case, than the parameters in your URL
http://jiraexample.com/rest/api/2/search?jql=project=ACCT&summary~chihuahua
are parsed like so:

  • param1:
    • key: jql
    • value: project=ACCT
  • param2:
    • key: summary~chihuahua
    • value: null (no value)

So, effectively, your finding all issues in the project "ACCT".

Solution:

Use " AND " instead of "&" in your JQL query:

http://jiraexample.com/rest/api/2/search?jql=project=ACCT%20AND%20summary~chihuahua

Dickson April 21, 2015

Yes this works, I also got around it by sending a POST with the jql in json to just the /search

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.
April 20, 2015

If you need exact summary match, use "=" instead of "~":

http://jiraexample.com/rest/api/2/search?jql=project=ACCT&summary=chihuahua
Andreas Ebert
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.
April 20, 2015

"=" is not a valid operator for the standard text fields, including summary.

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

Hello Dickson,

Thank you for your question.

You could narrow the search result down by adding extra parameters to the search:

# [JIRA-BASE-URL], i.e.: http://my.jira.dns
# [PROJECT-KEY], i.e.: ABC
# [USERNAME], i.e.: myuser
[JIRA-BASE-URL]/rest/api/2/search?jql=project=[PROJECT-KEY]&summary=[USERNAME]&fields=description

Please, refer to http://example.com:8080/jira/rest/api/2/search [GETPOST] for further information.

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

Dickson April 20, 2015

Extra parameters shouldn't be needed, if I only have one account that has a summary of "chihuahua" shouldn't I be able to get that one result just based on an exact summary match?

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

Could you attach a screenshot from your page summary, please?

Dickson April 20, 2015

Can I email it to you? The chihuahua is just an example, I'm dealing with a bit more confidential data.

TAGS
AUG Leaders

Atlassian Community Events