Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,066
Community Members
 
Community Events
184
Community Groups

Bitbucket Cloud - Automatically add default approvers when creating a new pull request via the API

Hello, using the Bitbucket CLOUD API:

  • Is there a way to have default approvers automatically added when creating a new pull request?

and/or:

  • Is there an endpoint to get a list of a repository's default approvers?

Thanks in advance for any pointers!

1 answer

1 accepted

1 vote
Answer accepted
Ulrich Kuhnhardt _IzymesCo_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 16, 2023

Welcome to the community @Paolo_Ascari !

I suppose you could fetch the repository or project default reviewer configuration via the Bitbucket REST API [1] and update the pull request with these reviewers [2].

Another option is to use a convenient app like Workzone for Bitbucket cloud [3] where you can configure reviewers or reviewer groups at branch- or even file/path-level and the app will add them automatically when a PR is created. You can also enforce how many approvals you require before the PR can be merged.

Hope that helps, and please let me know if you need any further assistance.

Best, Ulrich

 

[1] https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-effective-default-reviewers-get

[2] https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-pull-request-id-put

[3] https://marketplace.atlassian.com/apps/1211303/workzone-pullrequest-workflow?hosting=cloud&tab=overview

Disclosure: Izymes offers Workzone for Bitbucket Cloud and Server on the Atlassian Marketplace.

Hello Ulrich, and thank you for the detailed reply.

The default reviewers endpoint [1] has proven very useful, so we are going with that.

It's unfortunate that, when creating pull requests, the API doesn't mimic the front-end (i.e. automatically adding default reviewers), which means we always have to call an additional endpoint first.

Personally, I believe that the API endpoint should always add the default reviewers if this field is missing from the payload, as the caller would still have the option to pass an empty array to intentionally obtain the current behaviour.

Cheers, Paolo

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events