Hi,
I manage to successfully create a repository using the REST API by using that kind of REST call:
curl -X POST -v -u username:password -H "Content-Type: application/json" \ https://api.bitbucket.org/2.0/repositories/teamsinspace/new-repository4 \ -d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }'
However, this repository is created in an arbitrary project ? How can I specify the project when creating the repository ?
I didn't find anything related to project management in the REST documentation.
Thanks
Project support in some of our APIs (like repo creation) is lagging a bit. You are not currently able to a specify which project a repo should be created into. Know that we are actively working on filling those gaps though.
Once finished, you'll be able specify the project by adding the project object to your repo payload in the same way as it is currently included in the repo object:
-d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks", "project": {"key": "MYPROJ"} }'
By adding "name" parameter to post data:
-d '{"scm": "git","is_private": "true","fork_policy":"no_public_forks","name":"NewRepo"}'
-d
'{"scm": "git","is_private": "true","fork_policy":"no_public_forks","name":"NewRepo"}'
https://confluence.atlassian.com/bitbucket/repository-resource-423626331.html#repositoryResource-POSTanewrepository
The OP is asking how to specify the project, not the name.
Thanks, even if it's not the answer I expect to hear
@Erik van Zijst Are there any improments over this in the professionnal/private/paid version of Bitbucket ?
I'm the engineer currently working on the projects API and integrating projects into the rest of the APIs. As far as I can see, the work should be finished in 3 weeks, assuming no unexpected work derails the timeline (famous last words). Sorry for the inconvenience.
Hey. The basic project API has now been deployed. So you can created/update/delete projects via the API. You can see the documentation for that here: https://developer.atlassian.com/bitbucket/api/2/reference/search?q=tag:projects
Support for choosing the project during repository creation was recently finished and is in our deployment pipeline. It should get deployed today.
Hi, I have tried to specify project during repository creation like this:
{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks", "project": {"key": "MYPROJ"} }
but can not get it to work. Am I not doing it correct?
Could you please paste the exact command you're using and the actual response you're getting?
Hello, I have tried the following command:
curl -X POST -v -u user:pass https://api.bitbucket.org/2.0/repositories/myteam/myrepo -H "Content-Type: application/json" -d '{"is_private": true, "language": "php", "project": {"key": "PROJ"}}'
and got the response:
* upload completely sent off: 67 out of 67 bytes < HTTP/1.1 403 FORBIDDEN * Server nginx/1.6.2 is not blacklisted < Server: nginx/1.6.2 < Vary: Authorization, Cookie < Content-Type: application/json; charset=utf-8 < Strict-Transport-Security: max-age=31536000 < Date: Wed, 03 Aug 2016 19:56:55 GMT < X-Served-By: app-111 < X-Static-Version: c4b639339c4d < ETag: "2517d8a35dee8cb8cd9e5f0c889915ba" < X-Render-Time: 0.0306060314178 < X-Accepted-OAuth-Scopes: repository:admin < Connection: keep-alive < X-Version: c4b639339c4d < X-Request-Count: 235 < X-Frame-Options: SAMEORIGIN < Content-Length: 35 < * Connection #0 to host api.bitbucket.org left intact {"error": {"message": "Forbidden"}}
Can someone 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
Hi Guys,
Can anyone answer this question please? I'm trying to create a "Project" via API/bash script and the bit bucket API documentation is terrible. Any direction pointing to the correct API is much appreciated. I'm using bitbucket version 5.10.1
Cheers,
Carthik
It looks like you're new here. Sign in or register to get started.