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
Community Members
Community Events
Community Groups

Pull request creation - bad request 400



I have troubles creating a pull request via the bitbucket api. In my opinion I'm respecting the constraints of the format on how to approach the endpoint based on the documentation and other tickets in this space but I'm always receiving some vague error response "BAD REQUEST 400". 


Here the "resource url"  and the url used in the documentation are not the same but both lead to BAD REQUEST 400 to me.





Other ticket:

I use Postman and can access the resource to retrieve pullrequests:


But for the pull request creation I always have a bad request returning:


Evidence "develop" exists:


Is there something that I'm overlooking? Thanks!




1 answer

1 accepted

0 votes
Answer accepted

Hello @seanaty ,

Sorry for tagging you but you seem very knowledgeable on the topic (you solved the ticket I referenced to in the post). Would you, by any chance, be able to glance over this? I'm probably overlooking something basic.


seanaty Atlassian Team Aug 13, 2021

Based on the findings here: you can't actually add the authenticated users as a reviewer (check and see if you're doing that).

Lastly I would use UUID instead of username as that's generally been phased out.

I would also omit repository from both source and destination as they are redundant (the repository is already specified in the path). The only reason you'd need to specify a repo in the body is in the case of a pull request of a fork. I suspect that there is a problem with the body input with regard to how we identify a repository. We likely need to have the repository `full_name` or a `workspace` object to correctly lookup the repository. All that said, your best bet is to remove it from the body entirely.



Thank you for your response and your input. It was highly appreciated. I implemented it but not yet with success. There was also an extra semicolon after "develop" causing issue.


So now he still can't find the repository. He authenticates my user but can't find the repo associated. The same happens when I execute a GET:

image.png No repositories are found with my username which is not correct...
I do have 2 workspaces (personal + shared ) for my account but both have repos while this get doesn't return anything. Maybe this has something to do with that?

Again I'm desperate for help. Do you maybe have another idea or do you know another expert? :)


seanaty Atlassian Team Aug 17, 2021

Ah ok, this then is an authentication issue. When you look at your list of repos and see "0" that means you have private repositories (and no public repositories). As you are not authenticated correctly you see what the public and/or unauthenticated users see. Namely a list of your public repositories (which, in this case, happens to be 0).

You can use the /2.0/user API to see who you are currently authenticated as (or if you're authenticated)

I finally got it working. Thank you for guiding me in the right direction.

If it helps for someone else later.
2 things:

* Pull Request "Write"-rights aren't enough

* The documentation of Atlassian is not correct:


Unlike in the explicit example in the documentation above, to POST a new pull request you shouldn't connect via "repositories/my-username" but via "/{workspace}/{repo_slug}"


seanaty Atlassian Team Aug 23, 2021

Good catch about the documentation. I'll make a task to update the example. The parameter name is "workspace" but it used to actually be "username" of of the team, hence the example currently says "my-username".

Like Tim Piot likes this

Suggest an answer

Log in or Sign up to answer
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,223 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