I would like to fork a repository with Bitbucket API like GitHub has. https://developer.github.com/v3/repos/forks/#create-a-fork. Is it possible?
Thanks in advance.
Hi!
Please, try below thread
https://community.atlassian.com/t5/Answers-Developer-Questions/Example-of-a-REST-call-to-fork-a-repository-from-our-BitBucket/qaq-p/493479
I appreciate your answer but they talked about old API version in the thread and I cannot find the same one in new API version below:
https://developer.atlassian.com/bitbucket/api/2/reference/
API v2 for documentation:
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/forks
Overview of solution is to POST to the /repo/forks/ endoint
The 2.0 documentation is here but the POST body seems complicated. Would really like some actual examples... ie what are the minimum required fields?https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-post
I was able to figure this out using chrome tools while creating a fork from the BB UI. Here is a minimal example:Imagine I have a repo `foo` in workspace `myspace`. And I want to fork it into `foo-fork` in the same workspace. The request is
POST {{BB_API}}/repositories/myspace/myspace/forks{ "is_private": true, "scm": "git", "name": "foo-fork", "workspace":{ "slug":"myspace" }}
POST {{BB_API}}/repositories/myspace/myspace/forks
Thank you!
Can you provide a full template as an example.
It looks like you're new here. Sign in or register to get started.