Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,317
Community Members
 
Community Events
165
Community Groups

How do I add a reviewer when I create a pull request via the API?

Looking at the documentation here. This should work:

{
    "title": "My Title",
    "source": {
        "branch": {
            "name": "my-feature-branch"
        }
    },
    "reviewers": [
        {
            "uuid": "{504c3b62-8120-4f0c-a7bc-87800b9d6f70}"
        }
    ]
}

But it does not, I get a 400.

If I remove the "reviewers" property from the json, the PR creates successfully.

I have confirmed the uuid that I am using is correct (via a call to {{baseUrl}}/workspaces/:ourworkspace/members) and has access to the repo.

So, I don't 'think' I'm doing anything wrong. Can you confirm the functionality works and the documentation is correct? And if so, any suggestions for what else to try?

This is my json:

{ "title": "my PR title",
"source": { "branch": { "name": "sourcebranch" } },
"destination": { "branch": { "name": "develop" } },
"reviewers": [ { "uuid": "{valid-uuid}" } ]

}

1 answer

0 votes

Hi Mark,

I can confirm that this works for me using an API call like the following:

curl -u <username>:<app-password> -X POST https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo-slug>/pullrequests -H "Content-Type: application/json" -d '{"title":"My Title","source":{"branch":{"name":"test3"}},"destination":{"branch":{"name":"master"}},"reviewers":[{"uuid":"{85h7ba24-d516-4fo6-980c-e5fa6829a41e}"}]}'

Could you try testing the API call with curl (in case you haven't already)?
If you get the same error, could you please copy-paste here the exact call and the full output, sanitizing any private/sensitive info like username, password, workspace-id etc?

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,228 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you