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

Using bitbucket api 2.0 to create a PR and having problems with reviewers

Hudson Luiz Sales Schumaker July 25, 2023

HI, 

using the api https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-post

to create PRs, but if i add the reviewers attribute I get 400. in the documentation shows to use this partner 

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

is something broken in this api ?

and I check the api to get the pull resquests https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-get
thats show the "reviewers": [ { "type": "<string>" } ], attribute in the docs. but the attribute is no coming.

regards

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 26, 2023

Hi Hudson,

There is nothing broken with this API endpoint.

An example call with curl that works is the following:

curl --header 'Authorization: Basic redacted' -X POST https://api.bitbucket.org/2.0/repositories/my-workpsace/my-repo/pullrequests \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{ "title": "My Test PR", "source": {"branch": {"name": "feature-branch" } }, "reviewers": [ { "uuid": "{some-uuid}" } ] }'

A 400 error usually indicates a malformed request syntax.

Could you perhaps post here the call you are making, and replace the actual values of private/sensitive info with dummy values? We can then check if something is not correct in that request.

Kind regards,
Theodora

Hudson Luiz Sales Schumaker July 26, 2023

Hello Theodora Boudale
run the example you put here and see it works, does not. I figured it out the error, lets see if you can find the error on your example, after you find, please update the documentation.

best regards, 

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 26, 2023

Hi Hudson,

I did run the request I posted it here and it was successful. The PR was created with the reviewer added.

If you believe you found an error, please feel free to share.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events