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

Bitbucket API: Add default reviewers using usernames

Kaliyug Antagonist April 22, 2020

On-prem server Bitbucket 6.10.

Referring to the API for adding default reviewers for a project.

POST Request:

https://git.company.net/rest/default-reviewers/1.0/projects/test-project/condition

Body:

{"sourceMatcher":{"id":"any","type":{"id":"ANY_REF"}}, "targetMatcher":{"id":"any","type":{"id":"ANY_REF"}}, "reviewers":[{"name": "p950a", "slug": "p950a", "id": 56111},{"name": "p950h", "slug": "p950h", "id": 45222}], "requiredApprovals":"0"}

It seems it's mandatory to pass "id" for each reviewer - "slug", "name" don't seem to work. I get the following error if "id" is excluded.

{ "errors": [ { "context": null, "message": "No user exists for identifier -1.", "exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException" } ] }

It's quite inefficient and tedious to retrieve IDs for several users, store them and then again iterate over that list to pass here. Is there a better way to do this or am I missing something?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events