Getting a list of all users through REST API

I want to create a new Project through the REST API and assign the Project Lead.  This means I need to use the /user/picker or /user/search endpoints so the user can select any active user in JIRA.

Both endpoints have a mandatory username/query parameter with an implicit leading wildcard.  This means I can't construct a list of users programatically by sending off a query for each letter in the alphabet as /user/search?username=a returns Adam and Edward.

This is a pretty basic thing to do so I'm sure others have come across the same problem.

Thanks.

 

2 answers

1 vote

Hi Karen,

This issue has been reported in the following case:

Please note, from the request, it does mention the following:

In various environments, it has been observed that setting username to one of the following characters will do the trick:

  • /rest/api/latest/user/search?username="" (double quotes)
  • /rest/api/latest/user/search?username='' (single quotes)
  • /rest/api/latest/user/search?username=. (dot)
  • /rest/api/latest/user/search?username=% (percent)
  • /rest/api/latest/user/search?username=_ (underscore)

Also, maxResults and startAt seem to be functioning.

You can give this a try in your environment and see if you're able to get any further, but do note that it doesn't seem to work for all Jira setups.

Kind Regards,
Shannon

0 vote

Hi Karen,

I am now sure whether you are using Cloud or not, however you should be able to get the list of all the assignable users for a project by using:

../rest/api/2/user/assignable/search?project=PROJECT_KEY

 

For details please see:

https://docs.atlassian.com/jira/REST/cloud/#api/2/user-findAssignableUsers

 

I hope this helps.

 

Best Regards,
Dario
Atlassian Cloud Support

Actually the same endpoint exists for JIRA Server too:

https://docs.atlassian.com/jira/REST/server/#api/2/user-findAssignableUsers

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Sarah Schuster
Posted Mar 28, 2018 in Jira Software

Can a company’s culture make or break agile adoption?

Can a new-to-agile team survive and thrive in a non-agile culture? If so, what advice would you give to those trying to be agile in a non-agile culture? What's the key(s) to success? Share your thoug...

12,063 views 15 13
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you