Hello,
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".
Documentation:
Here the "resource url" and the url used in the documentation are not the same but both lead to BAD REQUEST 400 to me.
Attempt:
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!
Kr
Tim
Based on the findings here: https://community.atlassian.com/t5/Bitbucket-questions/Re-Re-how-to-create-bitbucket-pull-request-using-bitbuc/qaq-p/912414/comment-id/33847#M33847 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
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:
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? :)
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.