1. Bitbucket
  2. Public Issue Tracker
  3. master


Issue #8195 resolved

REST API for creating pull requests

stephen mathieson
created an issue

it'd be really super cool if there was an API for creating pull requests :)

see github's api

Comments (10)

  1. Erik van Zijst staff
    curl -X POST -u username:password \
        https://api.bitbucket.org/2.0/repositories/{user}/{slug}/pullrequests/ \
        -d src=my_branch \
        -d title="Short description" \
        -d dest=master \
        -d description="Long description"

    The last 2 parameters are optional. The default destination is the repo's main branch.

    If you're creating a PR between forks, make the POST on the destination repo's URL, and add:

    -d src_repo=evzijst/fork

    Additionally you can add reviewers by repeating the reviewers param 1 or more times:

    -d reviewers=evzijst -d reviewers=nvenegas -d reviewers=...
  2. Erik van Zijst staff

    To merge a PR, just do:

    curl -X POST https://api.bitbucket.org/2.0/repositories/{user}/{slug}/pullrequests/{id}/accept


    curl -X POST https://api.bitbucket.org/2.0/repositories/{user}/{slug}/pullrequests/{id}/decline

    Both take an optional message parameter that allow you to explain why you're accepting or declining. In the former case that becomes the commit message of the merge.

  3. Log in to comment