Filter out Service Desk users: /rest/api/2/user/search/

Hello,

I’m using this API to retrieve a list of users for a dropdown list:

/rest/api/2/user/search/

That’s working fine, but it’s also returning a lot of Service Desk users that I don’t want in my dropdown. Is there a way to filter out all the Service Desk users (either via a parameter, or after the data is returned?)

Any guidance would be greatly appreciated!

Use the Find Users by query endpoint and specify exactly the user characteristics you need, thereby omitting the ones you don’t need.

Thank you for the speedy reply! I saw this endpoint, but it doesn’t look like it’ll work for instances where you have a large number of users. Here’s what the documentation says:

This operation takes the users in the range defined by startAt and maxResults, up to the thousandth user, and then returns only the users from that range that match the structured query. This means the operation usually returns fewer users than specified in maxResults.

I take this to mean that if you have more than 1000 legit Jira users (not including Service Desk users) then there’s a hard cap and I might not get the full list. Am I reading that right?

The 1,000 limit is just the per-query result limit. You can use pagination to get larger numbers of results (users) in batches with multiple queries.

Also, you have inferred that you intend to build a list with more than 1,000 users in it. The topic of creating massively long drop-down lists is extensively discussed in many UI forums and is widely considered to be a bad thing to do. Constrain your list to only contain the users who are absolutely relevant and applicable, which infers your initial query to the REST API should probably be more specific too.

1 Like