User search api sometimes returns empty array

Viktor Zhemchuzhnikov January 20, 2022

Hey everyone,

Sometimes JIRA returns an empty array in response to the following endpoint

rest/api/2/user/search?query=<email>

 for the same <email>. It happens randomly for random emails and I 100% that users with these emails are active and did not hide their email. It started approximately 1 month ago.

Can someone please clarify what can cause the problem and how can I fix it?

Thanks!

2 answers

0 votes
Tommy Augustine August 15, 2022

I think the GDPR changes are your problem. I get the empty array set everytime my system user doesn't have enough permissions. If you're an org owner and king Jira admin across the board, you should not receive an empty set.

0 votes
David Bakkers
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.
January 20, 2022

Hello @Viktor Zhemchuzhnikov 

Are you saying that the query:

A) Produces the same empty result when re-tried for the same email address (no results, ever, for a particular email address), or

B) Produces the correct result when re-tried (no results, sometimes, for a particular email address)?

If A, then it's a permission issue and you don't have the rights to lookup that person's information, which can be due a wide range of reasons. If B, then it's harder to say why it might be randomly failing.

Also, since you're using Jira Cloud, do you get the same result if you use the v3 User search endpoints instead of the old v2 Find users by query endpoint?

Viktor Zhemchuzhnikov January 20, 2022

Hello @David Bakkers 

It is B case. There was too small number of empty responses (3-5 of them for now) so it is hard to say if some specific group of users is affected or this can happen with everyone. For now it looks random.

Also thanks for suggesting v3 api, I'll test it.

 

UPDATE:

I wrote a simple script that queries my email every 5 minutes.

v2 endpoint seems to fail at the beginning of every hour (first request for each hour).

v3 endpoint works nice.

So changing to v3 will solve my issue but I do not think it should be the solution since v2 api is not deprecated and v3 is in beta.

David Bakkers
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.
January 24, 2022

Glad to hear you found a solution.

The v3 REST API has been the primary interface for years, and it's the v2 REST API that is more or less 'deprecated' because development of it ended years ago.

Suggest an answer

Log in or Sign up to answer