User Searches Using the REST API

Benjamin Dains May 8, 2018

Problem

When I try and search the API with this call it doesn't work. I've tried using double quotes, single quotes, percent, dot, underscores, and other ideas to get it to run, but no luck. 

This should give me users in that project, right?

https://yourinstance.atlassian.net/rest/api/latest/user/search?jql=project=BM

{
"errorMessages": ["The username or property query parameter must be provided"],
"errors": {}

}

--

I have also tried:

https://yourinstance.atlassian.net/rest/api/latest/user/search?project=BM

https://yourinstance.atlassian.net/rest/api/latest/user/search?projectkey=BM

https://yourinstance.atlassian.net/rest/api/latest/user/search?'project in (BM)'

Additional Information

When I try and search the API with this call it does work, so I know the endpoint works, but I'm not sure how to get the search above to work.

https://yourinstance.atlassian.net/rest/api/latest/user/search?username=user.name

[
{
"self": "https://yourinstance.atlassian.net/rest/api/2/user?username=user.name",
"key": "",
"accountId": "",
"name": "",
"emailAddress": "",
"avatarUrls": {
"16x16": "",
"24x24": "",
"32x32": "",
"48x48": ""
},
"displayName": "",
"active": true,
"timeZone": "",
"locale": ""
}
]

 

 

2 answers

1 accepted

1 vote
Answer accepted
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 8, 2018

Benjamin, 

There isn't a way to retrieve users from a particular project like you are trying to do.

I would instead look to find the roles availible in a project using this api 

/rest/api/2/project/{projectIdOrKey}/role

and then use those project roles to identify the users that occupy those roles. 

rest/api/2/project/{projectIdOrKey}/role/{id}

Benjamin Dains May 8, 2018

@Kian Stack Mumo Systems thanks for the quick reply! I appreciate the help. :)

0 votes
Alexey Matveev
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 8, 2018

Hello,

Are you sure that you use the correct Rest call in the first case? The rest/api/latest/user/search

call must return users and it does not take the jql parameter. Maybe you wanted to use /rest/api/2/search?

Benjamin Dains May 8, 2018

@Alexey Matveev thanks for the reply, @Kian Stack Mumo Systems let me know it's not possible to retrieve users by project like I was trying to do.

Suggest an answer

Log in or Sign up to answer