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.
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
$
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.