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

XMLWordPrintable

    • 1
    • Severity 3 - Minor

      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.

            Assignee:
            David Jansons
            Reporter:
            Tahir Bhat (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: