Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

problems creating PR's between forks using the API

palmin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 26, 2019

I'm trying to add pull request support to my Git client Working Copy and having trouble pull request is between forks. In these tries I'm authenticated as user=workingcopy that has pullrequest privileges.

Specifically I try to make a PR where the source master branch on
    https://bitbucket.org/workingcopy/game/
and the destination is master branch on
    https://bitbucket.org/palmin/game/

I POST the pull request content


    {"title" = "My title",
     "destination": {"branch": "master"},
     "source": {"branch": "master",
     "repository": {"repo_slug": "game",
     "username": "workingcopy"}}
    }


to the endpoint
    https://api.bitbucket.org/2.0/repositories/palmin/game/pullrequests
but this gives me the errror message
   "Source and destination must be different"

I tried including the "repository" dictionary inside "destination" but the error is the same.

I'm also having trouble creating cross-repository pull requests when branch names are different.

Trying to create a pull request where the source master branch on
    https://bitbucket.org/workingcopy/game/
and the destination is release branch on
    https://bitbucket.org/palmin/game/
I get the error message
    "You do not have access to repository palmin/game and therefore you can not create a pull request."

The web-interface allows me to open a pull request like this when logged in as "workingcopy".

Any suggestions on things to do differently?

1 answer

1 accepted

0 votes
Answer accepted
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 12, 2019

Hi Anders,

I've talked to some of my colleagues from the Bitbucket Cloud team and they provided the following solution. Can you edit this command according to your needs?

curl -X POST -H "Content-Type: application/json" -u username:apppass https://bitbucket.org/api/2.0/repositories/testingteamlog/repositorya/pullrequests -d '{ "title": "anotherBranch to master", "description": "AUTO: anotherBranch to master", "source": { "branch": { "name": "anotherBranch" }, "repository": { "full_name": "testingteamlog/repositorya" } }, "destination": { "branch": { "name": "master" } }, "close_source_branch": false }'
his syntax was wrong
he used this for source:

"source": {"branch": "master",
"repository": {"repo_slug": "game",
"username": "workingcopy"}}

while this is the source:
source": { "branch": { "name": "anotherBranch" }, "repository": { "full_name": "testingteamlog/repositorya" } }

Hope that helps!

Ana 

palmin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 12, 2019

Thank you. This is just what I needed. 🙏

 

Not sure why I couldn't figure this out on my own, but I did try many things.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events