代码之家  ›  专栏  ›  技术社区  ›  Curl User

按cURL删除位桶存储库

  •  3
  • Curl User  · 技术社区  · 12 年前

    有人知道如何通过cURL从bitbucket中删除存储库吗?

    目前,我已经编写了脚本,通过curl在bitbucket上创建远程存储库

    #!/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
    

    但现在我无法通过curl从bitbucket中删除存储库

    我正在使用

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

    并在调用中出现错误{“error”:{“message”:“'username'”,“detail”:“File\”/opt/python/domains/bitbucket.org/current/bitbucket/local/env/lib/python2.7/site packages/piston/resource.py\”,第208行\n}

    https://bitbucket.org/zhemao/bitbucket-cli 只从用户帐户中删除存储库,但不能选择删除我所属的其他所有者拥有的存储库。

    有什么想法吗?

    1 回复  |  直到 12 年前
        1
  •  6
  •   TachyonVortex    12 年前

    的语法 deleting repo与的语法不同 creating 回购。

    要创建:

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

    要删除:

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

    此外,API v1.0方法已弃用,因此应使用 v2.0 methods .

    要创建:

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

    要删除:

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