Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

77 views 0 2
Join discussion

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