src Resources

Overview

You can use the Bitbucket src resource to browse directories and view files. This is a read-only resource.

GET a list of repo source

Gets a list of the src in a repository. You must supply the following parameters:

Parameter Description
accountname A team or individual account name.
repo_slug The repository's name.
revision A value representing the revision or branch to list.
path The path can be a filename or a directory path. If path ends with / it is interpreted as a directory and returns a list.
https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/src/{revision}/{path}
  Click to view the data returned on success...
{
  "node": "40e232b389b9",
  "path": "Readme",
  "data": "Favorite Quotes from bitbuckians\n--------------------------------\n\nThis page lists the favorite quotes from any bitbuckian that cares to\ncontribute. This is a family-oriented site, so only post stuff you are\ncomfortable showing to your family. If your family is seriously abnormal, my\ncondolences and I'm going to reject your sadly twisted pull request.\n\nPlease don't change another user's quote as I'll reject that as well. After\nall, some quotes a meaningful to the people who submit them. You are free to\nfix and/or improve the CSS or code if you like.\n\nNow using SSH\n",
  "size": 571
}

GET raw content of an individual file

Gets information about an individual file. This method returns the file's size and contents.  If the file is encoded, this method returns the files encoding; Currently, Bitbucket supports only base64 encoding. You must supply the following parameters:

Parameter Required Description
accountname Yes A team or individual account name.
repo_slug Yes The repository's name.
revision Yes A value representing the revision or branch to list.
path Yes The path can be a filename or a directory path. If path ends with / (forward slash), Bitbucket interprets the path as a directory and returns a list.

Supply a path value whose end node is a file name.

https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/raw/{revision}/{path}
  Click to view the data returned on success...

Favorite Quotes from bitbuckians
--------------------------------

This page lists the favorite quotes from any bitbuckian that cares to
contribute. This is a family-oriented site, so only post stuff you are
comfortable showing to your family. If your family is seriously abnormal, my
condolences and I'm going to reject your sadly twisted pull request.

Please don't change another user's quote as I'll reject that as well. After
all, some quotes a meaningful to the people who submit them. You are free to
fix and/or improve the CSS or code if you like.

Now using SSH

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport