Is there a link between the download repo and the git source code

i.e is there a way to push (and retrieve) uploaded files (from the downloads tag) to the related git repository .. My need is to able to archive "in a same way" files coming from a git client and   iles uploaded via the bitbucket web interface.

Thx in advance for your answer.

 

1 answer

0 vote

Sure thing:

# Upload a new file:
$ echo Hello World > hello.txt
$ curl -s -u evzijst -X POST https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads -F files=@hello.txt

# List all files:
$ curl https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads | jq .
{
  "pagelen": 10,
  "values": [
    {
      "name": "hello.txt",
      "links": {
        "self": {
          "href": "https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads/hello.txt"
        }
      },
      "downloads": 0,
      "created_on": "2015-10-15T17:20:35.473794+00:00",
      "user": {
        "username": "evzijst",
        "display_name": "Erik van Zijst",
        "type": "user",
        "uuid": "{a288a0ab-e13b-43f0-a689-c4ef0a249875}",
        "links": {
          "self": {
            "href": "https://api.bitbucket.org/2.0/users/evzijst"
          },
          "html": {
            "href": "https://bitbucket.org/evzijst/"
          },
          "avatar": {
            "href": "https://bitbucket.org/account/evzijst/avatar/32/"
          }
        }
      },
      "type": "download",
      "size": 12
    }
  ],
  "page": 1,
  "size": 1
}

# Download a file:
$ curl -s -L https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads/hello.txt 
Hello World

# And remove it:
$ curl -s -u evzijst -X DELETE https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads/hello.txt 
$

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

29,306 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you