Skip to content

Get snippet patch between versions

GET
/snippets/{workspace}/{encoded_id}/{revision}/patch

Returns the patch of the specified commit against its first parent.

Note that this resource is different in functionality from the diff resource.

The differences between a diff and a patch are:

  • patches have a commit header with the username, message, etc
  • diffs support the optional path=foo/bar.py query param to filter the diff to just that one file diff (not supported for patches)
  • for a merge, the diff will show the diff between the merge commit and its first parent (identical to how PRs work), while patch returns a response containing separate patches for each commit on the second parent’s ancestry, up to the oldest common ancestor (identical to its reachability).

Note that the character encoding of the contents of the patch is unspecified as Git does not track this, making it hard for Bitbucket to reliably determine this.

encoded_id
required
string

The snippet id.

revision
required
string

A revspec expression. This can simply be a commit SHA1, a ref name, or a compare expression like staging..production.

workspace
required
string

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: {workspace UUID}.

The raw patch contents.

If the authenticated user does not have access to the snippet.

Media type application/json
Error

Base type for most resource objects. It defines the common type element that identifies an object’s type. It also identifies the element as Swagger’s discriminator.

object
type
required
string
error
object
message
required
string
detail
string
data

Optional structured data that is endpoint-specific.

object
key
additional properties
any
key
additional properties
any
Example generated
{
"type": "example",
"error": {
"message": "example",
"detail": "example",
"data": {}
}
}

If the snippet does not exist.

Media type application/json
Error

Base type for most resource objects. It defines the common type element that identifies an object’s type. It also identifies the element as Swagger’s discriminator.

object
type
required
string
error
object
message
required
string
detail
string
data

Optional structured data that is endpoint-specific.

object
key
additional properties
any
key
additional properties
any
Example generated
{
"type": "example",
"error": {
"message": "example",
"detail": "example",
"data": {}
}
}