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

The API Endpoint specified for creating PR in Bitbucket 8+ releases does not seem to be functioning correctly.

XMLWordPrintable

      Issue Summary

      The API Endpoint specified for creating PR in Bitbucket 8+ releases does not seem to be functioning correctly.

      This is reproducible on Data Center: (yes) / (no) Yes

      Steps to Reproduce

      1. Use any Bibucket 8+ release
      2. Try to create a PR using this rest endpoint

      Expected Results

      The API should create a PR

      Actual Results

      It fails with the following result.
      "toRef.repository.project must be supplied for this request","exceptionName":null

       curl -u admin:myPassword --request POST \
            --url 'http://10.224.215.190:7990/rest/api/latest/projects/test/repos/myrepo/pull-requests' \
            --header 'Accept: application/json' \
            --header 'Content-Type: application/json' \
            --data '{
              "title": "Talking Nerdy",
              "description": "Its a kludge, but put the tuple from the database in the cache.",
              "state": "OPEN",
              "open": true,
              "closed": false,
              "fromRef": {
                  "id": "refs/heads/testbranch",
                  "repository": {
                      "slug": "myrepo",
                      "name": null
      
                  }
              },
              "toRef": {
                  "id": "refs/heads/master",
                  "repository": {
                      "slug": "myrepo",
                      "name": null
      
                  }
              },
              "locked": false,
              "reviewers": [
                  {
                      "user": {
                          "name": "admin"
                      }
                  }
              ]
          }'
      {"errors":[{"context":null,"message":"toRef.repository.project must be supplied for this request","exceptionName":null}]}%
      
      

      Workaround

      Utilize the REST API from the 7.x release, specifically the one found in version 7.13 (https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp291). It's important to note that the newer API example does not mention the need to include "toRef.repository.project" in the payload, which causes the API call to fail.

              e74118b4e28d David Jansons
              ff680b6e4c29 Tahir Bhat
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: