The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Hyphen in /user/search query works incorrectly (like wildcard)

Kamil Koszarny {Appfire}
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2024

Calling Jira Cloud API like this:

/rest/api/3/user/search?query=TC-1

gives in response all users starting with 'TC': (TC1, TC-1, TC2, TC-11, TCanything, ...), while expected result for this query would be to only return users starting with 'TC-1' (TC-1, TC-11, TC-1anything ...). It seems like hyphen '-' works as some wildcard, while it is not stated as wildcard in API documentation (link below).

 

I see 2 solutions:

1. Hyphen is and will stay as special character and I should escape it or use another query. How I can do that to achieve what I need? Then also API docs update would be helpful. 
2. Hyphen should not be treated as special character and you can fix that behaviour on your site.

 

Please inform which of those two applies and help. Thank you.

 

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-user-search/#api-rest-api-3-user-search-get

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Jehan Bhathena
Community Champion
January 4, 2025

Hi @Kamil Koszarny {Appfire} 

I tried out this API, this is quite strange as per their own documentation there is no indication of this special character.

What I did find was though, in JQL "https://confluence.atlassian.com/jirasoftwareserver/search-syntax-for-text-fields-939938747.html#Searchsyntaxfortextfields-exactsearches" they using hyphen as a negative search, maybe the API acts the same way :-\

There was some discussion in this about wildcards : https://jira.atlassian.com/browse/JRACLOUD-29069, but no concrete output from this either.

Another thread with something similar but no concrete output https://community.developer.atlassian.com/t/get-all-jira-users-with-ap/32355

I would highly recommend raising a support ticket with Atlassian to get a response from their dev team. I've also tagged the Atlassian Support on this ticket to bring to their attention.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events