Bitbucket Data Center icon

Bitbucket Data Center

Interact with Bitbucket Data Center API

Actions29

Overview

This node interacts with the Bitbucket Data Center API to manage branches within repositories. Specifically, for the Branch - Delete operation, it allows users to delete a branch from a specified repository in a project. This is useful for automating cleanup of feature branches after merging or removing obsolete branches programmatically.

Practical examples include:

  • Automatically deleting branches after pull requests are merged.
  • Cleaning up stale branches in bulk based on certain criteria.
  • 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 where the branch exists.
Repository The slug (identifier) of the repository within the project.
Branch Name The name of the branch to be deleted.

Output

The output JSON for the delete branch operation returns an object indicating success:

{
  "success": true
}

This confirms that the branch was successfully deleted. No additional data about the branch or repository is returned.

The node does not output binary data for this operation.

Dependencies

  • Requires access to a Bitbucket Data Center server.
  • 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 will cause the API call to fail.
    • Attempting to delete a non-existent branch will likely result in an error.
    • Insufficient permissions for the provided credentials can cause authorization errors.
    • Network connectivity issues to the Bitbucket Data Center server.
  • Error messages:

    • Bitbucket Data Center API request failed: ... indicates a failure in the API call. Check the message for details such as 404 (not found), 403 (forbidden), or 401 (unauthorized).
    • "The operation "delete" is not supported for resource "branch" would indicate a misconfiguration but is unlikely if using the correct operation.
  • Resolutions:

    • Verify project key and repository slug values.
    • Ensure the branch name is correct and includes no extra whitespace.
    • Confirm the API credentials have sufficient permissions to delete branches.
    • Test connectivity to the Bitbucket server URL configured in credentials.

Links and References

Discussion