Search code examples
apibitbucketbitbucket-api

Using BitBucket's API to fork a repository


There's any way to fork a repository using BB's API?

From what I've read on the API's docs, there isn't any explicit one: https://confluence.atlassian.com/display/BITBUCKET/Repositories

My idea is to create a new repo and point that it's a fork of another one, so I can create pull requests later.


Solution

  • You can use the API to fork a repository, either using Basic authorization or OAuth.

    The method to fork a repository:

    Using a authorized POST-request with required post data "name". https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/fork/

    Full documentation with optional parameters here: http://restbrowser.bitbucket.org/