Jira REST API - Get user account ID without username

Hi team!

I have a software that uses Active Directory to control user authentication and Jira REST API to complement user data.

To find the user in Jira, we use the request GET /rest/api/3/user/bulk/migration with query parameter username (using the AD username), so that we can retrieve the user account ID in the response, and proceed to the request GET /rest/api/3/user with query parameter accountId.

The problem is, for a few months now, this request is not able to find some usernames, returning a response like below:

        "username": "user.name",
        "accountId": "unknown"

Everytime this happens, I can manually find the user through Jira website (looking for first name, for example).

I believe this can be related to GDPR, and maybe Jira does not store usernames anymore, but I’d like a confirmation about it.

I’d like to know if there’s some other way to find a user (and only one) without its account ID.

I’ve tested the request GET /rest/api/3/user/search with query parameter query, using the first name to search for Display Name, but it can return multiple users and I’ve noticed in my company some users have their first name as Display Name, so I wouldn’t have anyway to garantee in my code which one is the user I’m looking for.

Any suggestions here will be really appreciated. Thanks a lot!

(This is my first time in this community, I’ve tried searching for a topic like this but didn’t find any, sorry if there’s one out there that I’ve missed.)

Playing around in the api using your idea of doing query I noticed you get all accounts in users/ but if you change it to user/search… you’ll get the user and their id.