Using PR merge API endpoint with repository access token does not work

XMLWordPrintable

    • 1
    • Severity 3 - Minor
    • 11

      Issue Summary

      When merging a pull request via API endpoint, it does not work using a repository access token as the authentication method.

      Steps to Reproduce

      1. Create a repository access token in a repository
      2. Merge an open pull request using the API endpoint below and run it in a CURL command
        curl -vv --request POST \
          --url 'https://api.bitbucket.org/2.0/repositories/workspace_id/repo_name/pullrequests/pull_request_id/merge' \
          --header 'Authorization: Bearer ACCESS_TOKEN_HERE' \
          --header 'Accept: application/json' \
          --header 'Content-Type: application/json' \
          --data '{
          "message": "merge",
          "close_source_branch": false,
          "merge_strategy": "merge_commit"
        }'
        

      Expected Results

      The pull request will be merged using a repository access token

      Actual Results

      The pull request can't be merged using a repository access token

      Workaround

      A possible workaround is to use a Bitbucket Cloud username and app password for authentication or use OAuth 2.0 to generate an access token.

            Assignee:
            Unassigned
            Reporter:
            Mark C
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: