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 Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

715 views 0 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot