Bitbucket Data Center icon

Bitbucket Data Center

Interact with Bitbucket Data Center API

Overview

The node interacts with the Bitbucket Data Center API to manage pull requests within a specified project and repository. Specifically, the "Unapprove" operation removes an approval from a given pull request. This is useful in workflows where automated or manual revocation of approvals is needed, for example, if code changes require re-review after updates or if an approval was mistakenly applied.

Practical scenarios include:

  • Automatically unapproving a pull request when new commits are pushed.
  • Revoking approval as part of a quality gate or compliance check.
  • Integrating with other systems that trigger unapproval based on external events.

Properties

Name Meaning
Authentication Method of authentication: either "Personal Access Token" or "Basic Auth".
Project The key of the Bitbucket project containing the repository and pull request.
Pull Request ID The numeric identifier of the pull request to remove approval from.

Output

The output JSON contains the response from the Bitbucket Data Center API after attempting to unapprove the pull request participant (the current user). It typically includes details about the updated participant status on the pull request.

Example structure (simplified):

{
  "user": {
    "name": "username"
  },
  "approved": false,
  "status": "UNAPPROVED"
}

If the operation succeeds, the approval status for the current user on the specified pull request is set to false.

No binary data output is produced by this operation.

Dependencies

  • Requires access to a Bitbucket Data Center instance with appropriate API permissions.
  • Requires either a Personal Access Token or Basic Authentication credentials configured in n8n.
  • The node uses the Bitbucket Data Center REST API endpoint /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants to update approval status.
  • The node automatically determines the current username via the API to identify which participant's approval to revoke.

Troubleshooting

  • Common issues:

    • Incorrect project key, repository slug, or pull request ID will cause API errors.
    • Insufficient permissions for the API token or basic auth user to modify pull request participants.
    • Network connectivity issues to the Bitbucket Data Center server.
    • Failure to determine the current username if API permissions are limited.
  • Error messages:

    • "Bitbucket Data Center API request failed: ..." indicates an HTTP or authentication error; verify credentials and network access.
    • "Failed to get current username: ..." means the node could not retrieve the authenticated user's name; ensure the API token or credentials have user read permissions.
    • "The operation "unapprove" is not supported for resource "pullRequest" would indicate a misconfiguration but should not occur here since "unapprove" is supported.
  • Resolution tips:

    • Double-check all input parameters for correctness.
    • Confirm API credentials have necessary scopes/permissions.
    • Test API connectivity outside n8n to isolate network issues.
    • Enable "Continue On Fail" in the node settings to handle errors gracefully in workflows.

Links and References

Discussion