Add / remove reviewer

In the bitbucket UI interface you can click a + button to add a reviewer, or click the X button to remove a reviewer. However, for the API, the only end points are to add a default reviewer or delete a default reviewer. I can’t seem to figure out how reviewers array and participants array work with regards to adding/deleting a reviewer in the Bitbucket UI interface and how that relates to API calls. If I do the remove user from default reviewers DELETE /2.0/repositories/{workspace}/{repo_slug}/default-reviewers/{target_username} , it successfully removes that reviewer from the default reviewers list, however, they still show up on the bitbucket UI under reviewer. Additionally, if I add a reviewer to the default reviewers list, it adds them there, but they don’t show up on the bitbucket UI under reviewer. Does any one have any clarification on how this works?

1 Like

Are you talking about the actual pull request page view?

You can add reviewers in 2 ways

  1. If the PR exists, you can add reviewers interactively on the actual PR page
  2. You can configure pre-defined reviewers in the repo settings that are added when a PR is created - that’s done with the API calls you are referencing above.

To add/remove reviewers to/from an existing PR you would

  1. Fetch the PR
  2. Add reviewers to the JSON body
  3. PUT the whole payload back into Bitbucket.

Let us know if that covers your use-case.

Kind regards, Ulrich
// Izymes

1 Like

Thank you! That does help. I can now remove a reviewer with the PUT whole payload back into Bitbucket. For adding a reviewer, though, in the bitbucket UI when you click “add reviewer” it comes up with recommendations, and it’s hitting this API call: https://bitbucket.org/gateway/api/v1/recommendations . I also want to get a list of who a person could add as a reviewer, however, when I try to hit the recommendations API in Postman it says:

{
    "code": 401,
    "message": "Unauthorized"
}

Do you know a way I could generate a list of users to add as reviewers?