How to use the API to download a repo
I want to download one file from my Bitbucket repository. The documents I have found the following call API.
https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/raw/{revision}/{path}
However, I am struggling to figure out what my "accountname", "repo_slug", "revision" and "path" are.
If I open the "scripts" folder in my Bitbucket account, the browser displays the following link.
https://example.com/projects/MMMA/repos/iapc_reporting/browse/scripts
For the account name I used "MMMA", for repo_slug "iapc_reporting", for checking out the "master" branch, and for "scripts / main.py". Now the url looks like this:
https://api.bitbucket.org/1.0/repositories/MMMA/iapc_reporting/raw/master/scripts/main.py
Unfortunately, opening this link in my browser gives me a 404 error. How do I create this link correctly? If you had a V2 API solution, it would be even better.
source to share
If your server "example.com" is managed by a BitBucket server then the API URL should be:
https://example.com/rest/api/1.0/projects/MMMA/repos/iapc_reporting
See Bitbucket Server REST APIs .
In your case, since this is a private repo, with curl --user user:pw
:
https://example.com/rest/api/1.0/projects/MMMA/repos/iapc_reporting/raw/master/scripts/main.py
source to share