Bitbucket Data Center icon

Bitbucket Data Center

Interact with Bitbucket Data Center API

Overview

This node integrates with the Bitbucket Data Center API to perform various repository-related operations. Specifically, for the Repository - Fork operation, it allows users to create a fork of an existing repository within a specified project. This is useful in scenarios where developers want to create a personal copy of a repository to work on features or fixes independently before merging changes back.

Practical examples include:

  • Forking a shared repository to start development on a new feature branch.
  • Creating a sandboxed copy of a repository for experimentation without affecting the original.
  • Automating repository management workflows that require creating forks programmatically.

Properties

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

Output

The output JSON contains the response from the Bitbucket Data Center API after attempting to fork the repository. Typically, this includes details about the newly created forked repository such as its name, slug, project information, and other metadata returned by the API.

If the operation fails, the output may contain an error message describing the failure.

No binary data output is produced by this operation.

Dependencies

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

Troubleshooting

  • Common issues:

    • Invalid or missing project key or repository slug will cause the API call to fail.
    • Insufficient permissions for the authenticated user to fork repositories.
    • Network connectivity issues to the Bitbucket Data Center server.
    • Incorrect authentication method or expired credentials.
  • Error messages:

    • "Bitbucket Data Center API request failed: ..." indicates an issue with the API call; check credentials and endpoint URL.
    • "The operation "fork" is not supported for resource "repository" would indicate a misconfiguration or unsupported operation (not expected here if configured correctly).
  • Resolution tips:

    • Verify that the project key and repository slug are correct and exist in Bitbucket.
    • Ensure the API credentials have permission to fork repositories.
    • Check network access to the Bitbucket Data Center server.
    • Confirm the selected authentication method matches the configured credentials.

Links and References


Summary of execute() logic for Resource=Repository and Operation=Fork

  • Retrieves input parameters: project key, repository slug, authentication type.
  • Obtains credentials based on authentication selection.
  • Constructs the API endpoint URL for the repository to fork.
  • Sends a POST request to the Bitbucket Data Center API to fork the specified repository.
  • Returns the API response as JSON output.
  • Handles errors by throwing descriptive exceptions or continuing on failure if configured.

Discussion