How to create project in bit bucket using bit bucket REST API?

Vaasanthi January 12, 2018

We are trying to create projects in bit bucket automatically.

Tried the following  options and it didn't work. can some one guide?

1. curl -k -X POST --user UID:PWD "https://bitbucket.example.com/context/rest/api/1.0/projects" -d "name=vptest"

2. curl -X POST -v -u UID:PWD "https://bitbucket.example.com/projects" -H "Content-Type: application/json" -d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks"}'

3. curl-k -X POST --user "UID:PWD" https://bitbucket.example.com/rest/api/1.0/projects?name='test_project'

 

 

3 answers

1 accepted

0 votes
Answer accepted
edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2018

Hi Vaasanthi,

You can use this python api.

https://pypi.python.org/pypi/stashy/0.3

pip install stashy
import stashy

bitbucket = stashy.connect(host, user, pass)
bitbucket.projects.create("TEST", "Test")
1 vote
Prakash Ganeshan June 18, 2019

I am able to create a project in Bibucket server using this API:

 

curl -D- -u username:Password -d "{ \"key\": \"PRA\", \"name\": \"My project\", \"description\": \"My First project through API\" }" -H "C
ontent-Type: application/json" http://servername:7990/rest/api/1.0/projects

Vvp Vp March 17, 2021

I have a similar request

 

curl -D- -u username:Password -d "{ \"key\": \"PRA\", \"name\": \"My project VVP\", \"description\": \"My First project through API\" }" -H "Content-Type: application/json" https://bitbucketexample.com/rest/api/1.0/projects

*https://bitbucketexample.com replaced with my URL.

 

 

but i got an error

{"errors":[{"context":null,"message":"You are not permitted to access this resource","exceptionName":"com.atlassian.bitbucket.AuthorisationException"}]

 

I am a admin, so what is missing here.

0 votes
Rashmi May 1, 2019

Hi Vasanthi,

 

Were you able to create project using API?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events