Bitbucket with it’s RESTful API 2.0 supports managing pull requests without interface. In CLI you can request it with CURL. This older version of the documentation has better interface details.
Get pull request data with CURL
To get full data about specific pull request:
$ curl --user s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests/4
In return I get JSON with full info about my pull request #4 (put your username twice, password and reponame in command).
Create new pull request with RESTClient
To create new pull request we need to provide a lot of data with POST command, below how it looks in my RESTClient:
After firing Bitbucket shows pull request immediately:
Create new pull request with CURL
You can still create the same pull request with one liner:
$ curl -X POST -H "Content-Type: application/json" -u s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests -d '{ "title": "Merge some branches", "description": "stackoverflow example", "source": { "branch": { "name": "choose branch to merge with" }, "repository": { "full_name": "s3m3n/reponame" } }, "destination": { "branch": { "name": "choose branch that is getting changes" } }, "reviewers": [ { "username": "some other user needed to review changes" } ], "close_source_branch": false }'
REST browser tool (discontinued)
If you want to test all possible methods of API hop to REST browser tool of Bitbucket. It will show you all possible requests while returning your real repo’s data.