Skip to main content

Bitbucket Data Center

Updated yesterday

By integrating Bitbucket with DX, you can analyze pull requests, repositories, and workflow data. Please visit our schema explorer to see what data DX imports—note that DX does not read or access your source code.

Prerequisites

To connect Bitbucket to DX, you need:

  • a Bitbucket service account

  • if your Bitbucket instance is behind a firewall or has IP restrictions, you need to allowlist DX IP addresses

Setup instructions

Step 1

  1. Create a user account in Bitbucket Data Center to use as a service account.

  2. Grant the user access to the projects that you would like imported into DX.

Step 2

  1. Navigate to the connector setup form in DX.

  2. Enter the credentials you have generated in the previous steps—refer to the information below for errors and troubleshooting.

API Reference

The table below lists the specific API endpoints that are used by DX.

Endpoint

Documentation

/projects

/projects/{project_key}/repos

/projects/{project_key}/repos/{repository_slug}/pull-requests

/projects/{project_key}/repos/{repository_slug}/pull-requests/{pull_request_source_id}/diff

/projects/{project_key}/repos/{repository_slug}/pull-requests/{pull_request_id}/activities

/admin/users

Errors

The table below lists potential error codes when adding a connection in DX.

Error

Description

invalid_credentials

Your API credentials entered are not valid.

invalid_permissions

Your API token does not have the permissions required by DX.

no_resources

Your service account does not have access to any projects or repositories.

Webhooks

DX supports Bitbucket Data Center webhooks ingestion to sync pull request data in real-time. This may be beneficial for large organizations that have difficulty keeping data up-to-date in DX through batch imports.

To enable webhook ingestion, follow the steps below:

  1. Go to Repository settings -> Webhooks -> Create Webhook

  2. For URL, enter your instance URL (yourinstance.getdx.net) followed by /webhooks/bitbucket_data_center

  3. Enter the secret provided to you by your DX account manager.

  4. Choose following events:

    1. Opened

    2. Modified

    3. Approved

    4. Declined

    5. Unapproved

    6. Merged

  5. (Optional) Test the connection by clicking on Test connection.

  6. Click on Save.

Here's an example configuration:

Did this answer your question?