Bitbucket Data Center icon

Bitbucket Data Center

Interact with Bitbucket Data Center API

Overview

This node interacts with the Bitbucket Data Center API to retrieve activities related to a specific pull request within a repository. The "Get Activities" operation fetches all recorded actions and events (such as comments, approvals, merges, etc.) associated with a given pull request.

This node is beneficial in scenarios where you want to monitor or audit the history of changes and interactions on a pull request. For example, it can be used to:

  • Track the timeline of a pull request for review automation.
  • Generate reports on pull request activity.
  • Trigger workflows based on specific pull request events.

Practical example: Automatically fetching all activities of a pull request to notify a team chat channel about recent updates or comments.

Properties

Name Meaning
Authentication Method of authentication to use: Personal Access Token or Basic Auth
Project The project key identifying the project containing the repository
Repository The repository slug within the project (required for pull request operations)
Pull Request ID The numeric ID of the pull request for which to get activities

Note: Although "Repository" is not explicitly listed in your provided properties snippet, it is required by the code for pull request operations and must be selected.

Output

The output is a JSON array where each element represents an activity record related to the specified pull request. Each activity object contains details such as the type of activity, user involved, timestamps, and any associated comments or status changes.

The structure corresponds directly to the Bitbucket Data Center API response for pull request activities under the endpoint:

GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/activities

No binary data is returned 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 endpoints.
  • The "Project" and "Repository" must exist and be accessible with the provided credentials.
  • The pull request ID must correspond to an existing pull request in the specified repository.

Troubleshooting

  • Common issues:

    • Missing or incorrect project key, repository slug, or pull request ID will cause API errors.
    • Insufficient permissions or invalid credentials will result in authentication failures.
    • Network connectivity issues to the Bitbucket server will cause request failures.
  • Error messages:

    • "Bitbucket Data Center API request failed: ..." indicates an issue with the API call, often due to invalid parameters or authentication.
    • "The operation "getActivities" is not supported for resource "pullRequest" would indicate a misconfiguration but should not occur if using the correct operation.
    • "Could not determine current username" may appear if approval-related operations are attempted without proper credentials; not relevant for getActivities but useful to know.
  • Resolutions:

    • Verify that the project key, repository slug, and pull request ID are correct.
    • Ensure the API credentials have sufficient permissions.
    • Check network access to the Bitbucket Data Center server.
    • Use the correct authentication method matching your credential setup.

Links and References

Discussion