changesets Resource

Overview

Use changesets resources to manage changesets resources on a repository. Unauthenticated calls for these resources only return values for public repositories. To see changeset resources on private repositories, the caller must be authenticated and must have at least read permissions on the repository. Changesets are read-only resources, you can't add or modify a changeset structure. You can modify the secondary resources such as comments associated with an individual change set node.

An individual changeset structure has the following information:

Field Description
node Unique ID for the changeset – this is an abbreviated SHA code.
files An array of files included in the changeset.
raw_author The username defined locally and included in the commit passed to the Bitbucket service.
utctimestamp Universal time stamp applied to the change.
timestamp The time provided on the local machine where the commit occurred.
author The Bitbucket account associated with the changeset.
raw_node A forty-character changeset hash – this is the unabbreviated SHA value.
parents The commit that your local directory was at before the changeset was committed. When a user adds a file, that file does not have a parent as there was no preceding commit.
branch The name of the branch on which the change resides. The branch name can be null and is typically so for Git repositories.
message The commit message.
revision An integer assigned to a commit. This field is used for Mercurial repositories only. The value itself is an integer that is valid only within the specific local repository.
size This field is reserved and always contains -1.

GET a list of changesets

Gets a list of change sets associated with a repository. By default, this call returns the 15 most recent changesets. It also returns the count which is the total number of changesets on the repository. Private repositories require the caller to authenticate. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
limit Yes An integer representing how many changesets to return. You can specify a limit between 0 and 50. If you specify 0 (zero), the system returns the count but returns empty values for the remaining fields.
start Yes A hash value representing the earliest node to start with. The system starts with the specified node and includes the older requests that preceded it. The Bitbucket GUI lists the nodes on the Commit tab. The default start value is the tip.
GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets?limit=integer?start=node
  Click here to expand...

GET an individual changeset

Gets a specific changeset  nodePrivate repositories require the caller to authenticate. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
node
Yes The node changeset identifier.
GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/{node}
  Click here to expand...

GET participants associated with an individual changeset

Changesets can be collaborated on by users through commenting and approvals. This list of people is embedded in the participants element in the commit object that is returned by Bitbucket's v2 API.

GET https://api.bitbucket.org/2.0/repositories/{accountname}/{repo_slug}/commit/{sha1}

GET statistics associated with an individual changeset

Returns an array containing statistics on changed file associated with a particular  node in a change set. Private repositories require the caller to authenticate. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
node Yes The node changeset identifier.

 The information returned by this call includes the following:

  • type of change
  • name of file
  • count of lines removed
  • count of lines added

Calculating the count of  lines added and removed (diffstat) can be expensive if the difference is very large. When the difference is large,  this call has the potential to time out and crash. To prevent crashes/timeouts, Bitbucket reports any large difference in the count of lines added or removed as a JSON null.  

GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/{node}/diffstat 
  Click here to expand...

GET the diff associated with a changeset

Gets the actual diff associated with the changeset node. This call returns the output as a string containing JSON. Private repositories require the caller to authenticate. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
node Yes The node changeset identifier.
GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/{node}/diff
  Click here to expand...

GET a list of comments on a changeset

Gets the comments associated with a particular changeset node. Users can create and edit comments on particular changesets. Private repositories require the caller to authenticate. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
node Yes The node changeset identifier.
GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/{node}/comments
  Click here to expand...

This call also returns markers for deleted comments where deleted is true. The following displays returns that include a deleted comment:

DELETE a comment on a changeset

Deletes the specified  comment_id associated with a particular changeset  node . To delete a comment, you must have administrative rights on the repository, the account, or be authenticated as the username associated with the comment. Private repositories require the caller to authenticate. This call takes the following parameters:

Parameter Require Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
node Yes The node changeset identifier.
comment_id Yes The comment identifier.
DELETE https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/{node}/comments/{comment_id}
  Click here to expand...

POST a new comment on a changeset

Adds a new comment to a changeset node. This call requires authentication. The call can add a new comment or create a comment in reply to another specified by the parent_id parameter. The system creates a comment on behalf of the authenticated caller. The authenticated caller must have administrative or write rights on the repository to POST a new comment.

Private repositories require the caller to authenticate. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
node Yes The node changeset identifier.
content Yes A Striing containing the content of the comment.
line_from No An integer representing the starting line of the comment.
line_to No An integer representing the ending line of the comment.
parent_id No An integer representing the unique ID of comment to which this is a reply.
filename No A String representing a filename in the changeset to which this comment applies.

POST https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/{node}/comments
  Click here to expand...

PUT an update to an existing changeset comment

Puts an update to an existing changeset comment identified by the comment_id. This call requires authentication. The system updates a comment on behalf of the authenticated caller. The caller must authenticate as a user with administrative privileges on the account, the repo, or as the user that created the comment. Private repositories require the caller to authenticate. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
node Yes The node changeset identifier.
comment_id Yes The comment identifier.
content Yes A Striing containing the content of the comment.
line_from No An integer representing the starting line of the comment.
line_to No An integer representing the ending line of the comment.
parent_id No An integer representing the unique ID of comment to which this is a reply.
filename No A String representing a filename in the changeset to which this comment applies.
PUT https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/{node}/comments/{comment_id
  Click here to expand...

Toggle spam flag on an existing changeset comment

Toggles the spam flag on a changeset comment identified by the comment_id. This call requires authentication. This call takes the following parameters:

Parameter Required? Description
accountname Yes The team or individual account owning the repo.
repo_slug Yes The repo identifier.
node Yes The node changeset identifier.
comment_id Yes The comment identifier.
PUT  https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/{node}/comments/spam/{comment_id
  Click here to expand...

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