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 votes

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
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

197 views 3 6
Read article

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