Details
-
Suggestion
-
Resolution: Unresolved
-
None
-
None
-
1
-
Description
Summary
The Default Reviewers APIs require the internal ids of users being configured as PR default reviewers to be passed for the POST methods.
Default Reviewers POST sample
Here's a sample request payload for a POST /rest/default-reviewers/1.0/projects/{projectKey}/condition request:
{ "sourceMatcher": { "active": true, "id": "ANY_REF_MATCHER_ID", "displayId": "ANY_REF_MATCHER_ID", "type": { "id": "ANY_REF", "name": "Any branch" } }, "targetMatcher": { "active": true, "id": "ANY_REF_MATCHER_ID", "displayId": "ANY_REF_MATCHER_ID", "type": { "id": "ANY_REF", "name": "Any branch" } }, "reviewers": [ { "name": "user1", "emailAddress": "user1@testdomain.com", "id": 51, "displayName": "User1", "active": true, "slug": "user1", "type": "NORMAL" } ], "requiredApprovals": 1 }
- Under "reviewers", the internal id of the user ("id": 51) is required to be able to find the user and set the user as a default reviewer.
The suggestion is to be able to pass an array of usernames instead of requiring the internal ids, similar to what is passed for Ref Restriction APIs.
Ref Restriction POST sample
A sample payload for the POST /rest/branch-permissions/2.0/projects/{projectKey}/restrictions request is:
{ "type": "pull-request-only", "matcher": { "id": "refs/heads/hotfix/hotfix2", "displayId": "hotfix/hotfix2", "type": { "id": "BRANCH", "name": "Branch" }, "active": "True" }, "users": [ "admin2", "user2" ], "groups": [], "accessKeys": [] }
- in this request, an array or user names is passed ("users": ["admin2","user2"])
Rationale
Default Reviewers APIs are used for exporting and importing these settings between Bitbucket instances. (Default reviewer settings are currently not included in the entities processed by Data Center Migration import and export APIs)
Internal ids of users may be different between the source and target instances. It would be more convenient if it was possible to pass usernames instead of first having to find out the correct user ids in the target instance for the default reviewers.
Attachments
Issue Links
- is related to
-
BSERV-12773 The source and target matcher fields should be consistently named between the GET and POST methods of the Default Reviewers APIs
- Gathering Interest
- relates to
-
BSERV-12775 Support bulk creation of default reviewers pull request conditions through the Default Reviewers REST APIs
- Gathering Interest