Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete bitbucket repository by cURL

Anyone know how to delete repositories from bitbucket by cURL ?

At the moment I've made script to create remote repository on bitbucket by curl

#!/bin/bash
while read line
do
curl --user user:password https://api.bitbucket.org/1.0/repositories/ --data name=$line --data is_private=true --data owner=OWNER
done<repo_list.txt

but now I cant delete that repositories from bitbucket by curl

Im am using

curl -X DELETE --user user:password https://api.bitbucket.org/1.0/repositories/ --data name=$line --data is_private=true --data owner=OWNER

and have error {"error": {"message": "'username'", "detail": " File \"/opt/python/domains/bitbucket.org/current/bitbucket/local/env/lib/python2.7/site-packages/piston/resource.py\", line 208, in call\n}

https://bitbucket.org/zhemao/bitbucket-cli delete repositories only from user account but dont have option to delete repository owned by other owner which I belongs to.

Any ideas ?

like image 809
Curl User Avatar asked Nov 14 '25 19:11

Curl User


1 Answers

The syntax for deleting a repo is different from the syntax for creating a repo.

To create:

POST https://bitbucket.org/api/1.0/repositories --data "name=mynewrepo"

To delete:

DELETE https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}

Also, the API v1.0 methods are deprecated, so you should use the v2.0 methods.

To create:

POST https://api.bitbucket.org/2.0/repositories/{owner}/{repo_slug}

To delete:

DELETE https://api.bitbucket.org/2.0/repositories/{owner}/{repo_slug}
like image 115
TachyonVortex Avatar answered Nov 17 '25 10:11

TachyonVortex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!