Hi,
I am trying to build a jenkins job for tech leads to manage their default reviewers.
I am trying to update the list of default reviewers for a repository using this api call
curl -X POST -H 'Content-Type: application/json' -u username:password http://bitbucket-url/rest/default-reviewers/1.0/projects/LEAR/repos/snarayananrepo/condition --data-binary '{"sourceMatcher":{"id":"any","type":{"id":"ANY_REF"}},"targetMatcher":{"id":"refs/heads/'"$BRANCH_NAME"'","type":{"id":"BRANCH"}},"reviewers":['"$payload"'],"requiredApprovals":"1"}'
https://docs.atlassian.com/bitbucket-server/rest/5.3.0/bitbucket-default-reviewers-rest.html
PUT removes removes the existing approvers, POST adds a new condition for the same branch instead updating the same condition matching and the last entry for the condition is picked up during pull request).
But everytime I do this, it creates a new entry in the defaults reviewers, instead I want to update the existing list of dafault reviewers. can someone please suggest how do I do that