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

BitBucket Cloud V2 API Return Bad Requests When Adding Reviewers to Pull Request

    XMLWordPrintable

Details

    Description

      I'm using Python to create a Pull Request against a repository. The api endpoint works well when I don't include the block for reviewers but if I set reviewers, I get a:

      400 Client Error: Bad Request for url https://api.bitbucket.org/2.0/repositories/***/***/pullrequests
      

      Here's the sample code:

      import requests
      from requests.exceptions import HTTPError
      
      try:
          data = {
              'title': 'My Title',
              'description': 'My Description',
              'close_source_branch': True,
              'source': {
                  'branch': {'name': 'my-branch'}
              },
              'reviewers': [
                  {'uuid': '{...}'},
                  {'uuid': '{...}'}
              ]
          }
          r = requests.post('https://api.bitbucket.org/2.0/repositories/***/***/pullrequests', auth=('username', 'password'), json=data)
          r.raise_for_status()
      
          print('>> setup is done.', r.json())
      
      except HTTPError as e:
          print('!> setup for is not done.', e)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            773b1df8cfe1 Jean-Bernard Ratte
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: