Rate this page:
Browse the source code in the repository and create new commits by uploading.
GET /2.0/repositories/{workspace}/{repo_slug}/filehistory/{commit}/{path}
Returns a paginated list of commits that modified the specified file.
Commits are returned in reverse chronological order. This is roughly equivalent to the following commands:
1 2$ git log --follow --date-order <sha> <path>
By default, Bitbucket will follow renames and the path name in the
returned entries reflects that. This can be turned off using the
?renames=false
query parameter.
Results are returned in descending chronological order by default, and like most endpoints you can filter and sort the response to only provide exactly the data you want.
For example, if you wanted to find commits made before 2011-05-18
against a file named README.rst
, but you only wanted the path and
date, your query would look like this:
1 2$ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\ '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18' { "values": [ { "commit": { "date": "2011-05-17T07:32:09+00:00" }, "path": "README.rst" }, { "commit": { "date": "2011-05-16T06:33:28+00:00" }, "path": "README.txt" }, { "commit": { "date": "2011-05-16T06:15:39+00:00" }, "path": "README.txt" } ] }
In the response you can see that the file was renamed to README.rst
by the commit made on 2011-05-16, and was previously named README.txt
.
repository
string
The commit's SHA1.
string
Path to the file.
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
string
When true
, Bitbucket will follow the history of the file across
renames (this is the default behavior). This can be turned off by
specifying false
.
string
Query string to narrow down the response as per filtering and sorting.
string
Name of a response property sort the result by as per filtering and sorting.
1 2 3 4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/filehistory/{commit}/{path}' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
A paginated list of commits that modified the specified file
Content type | Value |
---|---|
application/json |
GET /2.0/repositories/{workspace}/{repo_slug}/src
This endpoint redirects the client to the directory listing of the root directory on the main branch.
This is equivalent to directly hitting /2.0/repositories/{username}/{repo_slug}/src/{commit}/{path} without having to know the name or SHA1 of the repo's main branch.
To create new commits, POST to this endpoint
repository
string
This can either be the repository slug or the UUID of the repository,
surrounded by curly-braces, for example: {repository UUID}
.
string
This can either be the workspace ID (slug) or the workspace UUID
surrounded by curly-braces, for example: {workspace UUID}
.
string
Instead of returning the file's contents, return the (json) meta data for it.
Valid values: meta
1 2 3 4
curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/src' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'