Bitbucket Data Center icon

Bitbucket Data Center

Interact with Bitbucket Data Center API

Overview

This node interacts with the Bitbucket Data Center API to manage branches within repositories. Specifically, the "Delete" operation for the "Branch" resource allows users to delete a branch from a specified repository in a project. This is useful for automating repository maintenance tasks such as cleaning up feature branches after merging or removing obsolete branches.

Practical examples include:

  • Automatically deleting a feature branch after a pull request is merged.
  • Cleaning up stale branches in a repository on a schedule.
  • Integrating branch deletion into CI/CD pipelines to maintain repository hygiene.

Properties

Name Meaning
Authentication Method of authentication: "Personal Access Token" or "Basic Auth".
Project The key of the project containing the repository.
Repository The slug (identifier) of the repository where the branch exists.
Branch Name The name of the branch to delete.

Output

The output JSON contains an object indicating the success of the delete operation:

{
  "success": true
}

This confirms that the branch was successfully deleted. If an error occurs, the node will throw an error message describing the failure.

No binary data is output by this operation.

Dependencies

  • Requires access to a Bitbucket Data Center instance.
  • Requires either a Personal Access Token or Basic Authentication credentials configured in n8n.
  • The node uses the Bitbucket Data Center REST API endpoints under /rest/branch-utils/1.0/projects/{projectKey}/repos/{repositorySlug}/branches.

Troubleshooting

  • Common issues:

    • Incorrect project key or repository slug: Ensure these are valid and exist in your Bitbucket Data Center.
    • Branch does not exist or already deleted: The API will return an error if the branch name is invalid or missing.
    • Insufficient permissions: The authenticated user must have permission to delete branches in the repository.
    • Network or server errors: Check connectivity and Bitbucket server status.
  • Error messages:

    • "Bitbucket Data Center API request failed: ..." indicates an issue with the API call; check credentials and endpoint URL.
    • "The operation "delete" is not supported for resource "branch" would indicate a misconfiguration but should not occur here since "delete" is supported.
    • Permission denied or 403 errors mean the API token or user lacks rights to delete branches.

To resolve errors, verify credentials, project and repository identifiers, branch name correctness, and user permissions.

Links and References

Discussion