Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-12774

Support the specification of default reviewers as an array of usernames for the Default Reviewers APIs

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • API - REST
    • None
    • 1
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    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

          Activity

            People

              Unassigned Unassigned
              jmariano@atlassian.com JP Mariano
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: