We have BitBucket v5.10.0.
I've created a project and granted admin access to it.
I'd like to use that account to make REST calls to create repositories.
Is this possible to? and if so does anyone know the calls (using cURL or otherwise) that need to be made?
Since I asked this question, I came across the REST API browser and using the browser I can post and see the new repo. This has allowed me to see what endpoint I need to use; however, still not quite sure how to structure my curl statement...
Running this doesn't cause an update to the project... ie. no new repo.
curl -X POST -H "application/json" --user auser:theirpassword https://git-dev.csx.com/rest/api/1.0/projects/AN/repos --data '{"name":"rnstest","scmid":"git","forkable":"true"}'
Hi Shawn,
here is the method you can use - POST to /rest/api/1.0/projects/{projectKey}/repos
https://docs.atlassian.com/bitbucket-server/rest/5.10.0/bitbucket-rest.html#idm532026523120
Martyn,
Thank you so much for your response. I came up with a curl command, but something still isn't quite right as I don't see the repo getting created...
Here is my command:
curl -X POST -H "application/json" --user auser:theirpassword https://git-dev.csx.com/rest/api/1.0/projects/AN/repos --data '{"name":"rnstest","scmid":"git","forkable":"true"}'
What am I missing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you need to put the --data before the url
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You aren't gonna believe it... the issue is I needed to have the "Content-type:" in the header... like so:
curl -X POST -H "Content-type: application/json" --basic --user auser:theirpassword --data '{"name":"rnstest","scmid":"git","forkable":true}' https://git-dev.csx.com/rest/api/1.0/projects/AN/repos
Thank you for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shawn,
Can you please confirm the curl command to create new Bitbucket project as well as repo?
My bbt repo is something like below:
https://abc-bbt.corp.abc.com/bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.