Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-23659

REST API excludes draft pull requests from results

XMLWordPrintable

      Issue Summary

      The List pull requests REST API endpoint does not include draft pull requests in its response.

      Steps to Reproduce

      1. Create a draft pull request
      2. Use the List pull requests endpoint to fetch open pull requests for the repository: 
        https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests?state=OPEN

      Expected Results

      The API response should include all open pull requests for the repository, both draft and non-draft.

      Actual Results

      The response only includes non-draft open PRs, i.e. those with

      "draft": false

      Workaround

      To request draft pull requests from the REST API, format your request like this:

      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests?q=state%3D%22OPEN%22%20AND%20draft%3Dtrue

      To request all open pull requests (both draft and non-draft), format your request like this:

      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests?q=state%3D%22OPEN%22%20AND%20(draft%3Dtrue%20OR%20draft%3Dfalse)
      

              239301d37a3a Adam Coates
              dparrish Dave Parrish [Atlassian]
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: