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:
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests
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:
https://community.atlassian.com/t5/Bitbucket-questions/how-to-create-bitbucket-pull-request-using-bitbucket-rest-api/qaq-p/906404
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
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.
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.
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!
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)
It looks like you're new here. Sign in or register to get started.