devopsmaster
devopsmaster

Reputation: 81

How to create bitbucket repository using curl?

I have tried multiple ways like

curl -you 'USERNAME' https://api.bitbucket.org/1.0/repositories -d '{"name":"REPO"}'
curl -k -X POST --user user: pass \ "https://api.bitbucket.org/1.0/repositories" -d "name=project_name"

What am I missing?

Upvotes: 2

Views: 3716

Answers (1)

devopsmaster
devopsmaster

Reputation: 81

Nevermind the following worked for Bitbucket version 4.4

curl -X POST -v -u $uservar:$passvar http://<redacted>/rest/api/1.0/projects/$projectkeyvar/repos -H "Content-Type: application/json" -d "{\"name\": \"$reponamevar\",\"scmId\": \"git\", \"forkable\": true }"

I was using this in a shell script, hence the variables.

Upvotes: 6

Related Questions