I'm using this API documentation to create a Pull request on bitbucket but its not working, I keep getting a 401 - Unauthorized, even though I created a personal access token with Admin access and I "believe" I am using the correct username and access token (as my password) for the curl POST request:
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests#post
This is sample JSON:
curl https://api.bitbucket.org/2.0/repositories/my-username/my-repository/pullrequests \
-u my-username:my-password \
--request POST \
--header 'Content-Type: application/json' \
--data '{
"title": "My Title",
"source": {
"branch": {
"name": "staging"
}
}
}'What is my repository is listed under a "project name"? where the heck does the Project name go in the URL? and the "my-username" is just under the Bitbucket website "Manage accounts" -> "Name" , correct? If so, then my JSON should be correct.
Can anyone help me? If I go to the repository on the Bitbucket GUI in web browser, I can definitely log in and create Pull Request manually - why cannot I do this through REST API? What is the most common cause for 401 - Unauthorized? Do I need to request special access from the repository owners, even though I have my Admin access token, and I can view & make Pull requests on Bitbucket to this repo through web browser???