It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

problems creating PR's between forks using the API Edited

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 Apr 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 

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
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

4,094 views 4 22
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