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

yann gaste October 14, 2015

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
evzijst
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 15, 2015

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
TAGS
AUG Leaders

Atlassian Community Events