curlbitbucketbitbucket-api

Downloading from bitbucket using REST Api Bitbucket


recently I found that I can use Rest Api Bitbucket to download repositories. I read the docs, but so far I didn't manage to download any files, but some HTTP headers using curl.

Can someone give me a concrete example on how to use the API?

I understand that the command is curl https://api.bitbucket.org/2.0/repositories/, but my bitbucket links is something like this

http://company repository site/projects/project/repos/repo/

UPDATE 1

**

I managed to download a file using curl using the syntax: curl -u user:pass http://company_repository_site/projects/my_project/repos/my_repo/my_file.ext?raw but I would still like to know how can this be done using the REST Api

**

Thanks, Daniel.


Solution

  • In the end, I used

    curl -u user:pass `bitbucketCompanyServer`/rest/api/1.0/projects/`project`/repos/`repository`/browse/`fullPathToFileOnBitbucket`?at=`commit` > output
    

    Hope this helps