How to do user search with v3 REST API?

Dale Sedivec February 20, 2019

Hi, how can we get a list of users with the REST API?  I'm firing requests as a site admin user using ScriptRunner a la `/rest/api/3/user/search?query=dale` and I'm not getting any results, just `parsingError: present: true`.  Any help please?  Thanks, Dale

3 answers

1 accepted

1 vote
Answer accepted
Dale Sedivec February 21, 2019

OK, my apologies, this seems to be a problem with ScriptRunner, not the REST API.  Works fine hitting the REST API from my client with e.g. `.../user/search?query=dale.  I will take this up with Adaptivist.

Tom Hudgins July 28, 2022

When I run this I only get users who match the query and who are active (despite the API doc showing a sample result with inactive users). Seems like this isn't working correctly?? 

1 vote
Justin Alex Paramanandan
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.
February 20, 2019

Hi @Dale Sedivec 

Have you tried the new Find Users API?

https://{{host}}/rest/api/3/user/search?username=dale

 

Dale Sedivec February 20, 2019

No, because, quoting from Atlassian's documentation on the username parameter, "This parameter [username] has been deprecated due to privacy changes. Use query instead."

Justin Alex Paramanandan
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.
February 20, 2019

Indeed, and Cloud does not use the username as an identifier any longer.

EDIT: I just noticed the deprecation notice. Thanks for pointing it out.

I just tested with the following API query:

https://{{host}}/rest/api/3/user/search?query=<part of email address>

----------------------------------

With this API, I manage to get the detail of my account. Below is an example:

API Query:

https://justinalex.atlassian.net/rest/api/3/user/search?query=jusuchin85 

 The result (from Postman):

[
{
"self": "https://justinalex.atlassian.net/rest/api/3/user?accountId=557058:b9f93de3-8cc5-4e06-a39d-3d7b70896f7e",
"key": "admin",
"accountId": "557058:b9f93de3-8cc5-4e06-a39d-3d7b70896f7e",
"name": "admin",
"emailAddress": "jusuchin85+atlassian@gmail.com",
"avatarUrls": {
"16x16": "https://avatar-cdn.atlassian.com/a6cbe8f96e8fa69726ef4954e4f268e8?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fa6cbe8f96e8fa69726ef4954e4f268e8%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
"24x24": "https://avatar-cdn.atlassian.com/a6cbe8f96e8fa69726ef4954e4f268e8?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fa6cbe8f96e8fa69726ef4954e4f268e8%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
"32x32": "https://avatar-cdn.atlassian.com/a6cbe8f96e8fa69726ef4954e4f268e8?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fa6cbe8f96e8fa69726ef4954e4f268e8%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue",
"48x48": "https://avatar-cdn.atlassian.com/a6cbe8f96e8fa69726ef4954e4f268e8?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fa6cbe8f96e8fa69726ef4954e4f268e8%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue"
},
"displayName": "Justin Alex Paramanandan [ServiceRocket]",
"active": true,
"timeZone": "Australia/Sydney",
"locale": "en_US"
}
]

 

 

Like Dario B likes this
siviani_madrigal October 23, 2023

@Justin Alex Paramanandan  Hi, Is there a way we can add multiple email address in the API query?? for example: 

https://justinalex.atlassian.net/rest/api/3/user/search?query=jusuchin85 otheruserhere 
0 votes
Alex Ziegltrum August 2, 2023

Hey @Justin Alex Paramanandan 👋

is there a way to search for user accounts (customers), that have the leading "qm:" in their account ID? How do I do that?

Cheers, Alex

Suggest an answer

Log in or Sign up to answer