API to get Account ID from Email Address?

We are using Power Automate to create some flows to create Jira issues. All is working successfully, but we’d like to insert the Reporter as the person submitting the form. We have to pass the ‘accountId’ of the user, so is there an API I can call by passing in the user’s email address and returning the ‘accountId’ that I can pass in?

Thanks in advance,
Chris

Hi @ChrisGreen ,

Given an email address, you can try Find users API if it fits your use case.

EDIT:
You can pass the email address in the query query parameter just like /rest/api/3/user/search?query=ian@myemail.com. The accountId will be part of the response.

Cheers,
Ian

3 Likes

Hello @ChrisGreen

The Find users endpoint.

— Rats. Pipped by seconds :slight_smile:

1 Like

@ianRagudo - Boom! Thanks so much!

Chris

1 Like

@ChrisGreen I am trying to do the same with Power Automate. How did you setup the connector? Did you use send HTTP request?

I’m using a GET to https://proctorujira.atlassian.net/rest/api/3/user/search?query= and then I parse the results which contains the ‘accountId’.

What type of authentication are you usuing? I am trying basic with email and apikey but it doesnt authenticate and i get the error that it is deprecated?

@ChrisGreen I ended up generating a new api key was able to get it to work. Thanks so much for your response!

Trying exactly this today, and all I’m getting is an empty array, even when I use my own email. Anyone have any idea if something has changed with these?

Thank you!

I get this to work for all users within my domain, but I do have outside contributors and then I send a gmail address there I just get an empty result even though that email address has an account.
Any idea ?
I need to be able to set external sources as reporters, any thoughts or ideas ?

If you’re trying to look up a user by accountId, /rest/api/2/user?accountId=<accountId> worked for me.

The accountId query param isn’t documented afaik (Jira 9.4.0). It’s nice the api responded saying it exists (that’s how I found it).


My usecase was for finding the user’s displayName in a mention inside a comment (e.g.

This is a comment @User

returns

This is a comment [~accountid:<accountId>]

in the api)

Hi,
I get a restriction from GDPR :frowning:
“The query parameter ‘username’ is not supported in GDPR strict mode.”
Is there a way to workaround it ?
Regards,
Rémi

Hi @ChrisGreen @ianRagudo, I’m trying to do this very thing and can see you have solved this one - however could you help me with where I would put this code into the flow please? I’m struggling to see how to make this work.

After the ‘get response details’ step, I have a create a new issue step with a report ID field in it - do I need to create an interim step between the two to convert the Microsoft form ID to the Jira ID?

If you’re able to break this down for me (and advise the code/field I need to enter) I would be eternally grateful! Currently all Jira’s are being raised in my own name from the flow, and this would be a great improvement!

Many thanks in advance :slight_smile:

1 Like

A post was split to a new topic: Can you use multiple email address in Find users REST API