Retrieval of email Ids of PR reviewers and approvers

sumit_k_pal_pwc_com September 10, 2023

We are checking the feasibility of retrieving the email IDs of the PR reviewers and approvers for us to send post-deployment notification emails from Jenkins.

Please confirm if there are any APIs available for the same. 

1 answer

1 accepted

1 vote
Answer accepted
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 11, 2023

On Atlassian cloud, each user can decide whether his/her email address is visible. It is part of his account settings. If he/she makes it invisible, then the API will not return this field, either! If it is set visible, then the end-point that returns the user account details will return it.

Also, there is a dedicated Email API which will return the email address even if the user set that invisible. But it is open only for those apps/integrations for whom Atlassian approves the access.

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 12, 2023

Hello @sumit_k_pal_pwc_com and thank you for reaching out to Atlassian Community!

Just adding to @Aron Gombas _Midori_ response, currently, the Bitbucket Cloud API does not return a field containing the user's email due to privacy reasons.

You can use the Get a Pull Request API to fetch the information of reviewers and approvers, but it will not contain the email address: 

curl -X GET -u BB_USERNAME:APP_PASSWORD https://api.bitbucket.org/2.0/repositories/<Workspace>/<Repository>/pullrequests/<Pull Request ID>?fields=reviewers,participants

The example above will return the reviewers and participants (approvers) of a given Pull Request, including their Public Name, Bitbucket UUID (uuid field), and Atlassian Account ID ( account_id field).

We do have an existing feature request to return email addresses on Bitbucket Cloud APIs: 

We encourage you to Vote for that feature to give it traction, so our developers can understand the interest. Also, feel free to add yourself as a Watcher to receive first-hand updates on that feature.

However, while that feature is not available, if you are an Org Admin and want to get the email from managed users under your organization, this is possible using the Organization's API below: 

This API will also include the email address of the managed users. You can use this API in combination with Bitbucket API to match the account_id on both of them and find out the user's email.

Thank you, @sumit_k_pal_pwc_com !

Patrik S

Like Aron Gombas _Midori_ likes this
sumit_k_pal_pwc_com September 13, 2023

Thanks Aron and Patrik. Appreciate your reply.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events