Bitbucket Data Center Commits (Default branch)
By integrating Bitbucket Data Center Commits (Default branch) with DX, you can analyze commits data. Please refer to the API documentation below and our schema explorer to see what data DX imports—note that DX does not read or access your source code.
Prerequisites
To connect Bitbucket Data Center Commits (Default branch) 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
Follow the steps below to connect Bitbucket Data Center to DX.
Data connection
Step 1
Create a user account in Bitbucket Data Center to use as a service account, and grant the user access to the projects that you would like imported into DX.
Step 2
- Navigate to the connections page in DX and select “+ Connection” in the top right.
- 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/{key}/repos/{repo}/branches/default | Link |
| projects/{key}/repos/{repo}/commits | Link |
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 |
DX cannot access any projects or repositories. |
Curl commands
When connection verification fails
When DX verifies a Bitbucket Data Center connection, it checks access to commits. If your connection is failing, you can test these endpoints directly using the curl commands below to troubleshoot the issue.
Replace YOUR_BITBUCKET_URL, YOUR_USERNAME, and YOUR_PASSWORD with your actual values before running these commands.
1. Test Repo Commits Access
This verifies that your credentials can access commits:
curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_BITBUCKET_URL/rest/api/1.0/projects/{project_key}/repos/{repo_slug}/commits'
If you receive a 401 Unauthorized error, your credentials are invalid. If you receive a 403 Forbidden error, your service account doesn’t have the required permissions. If you receive a 404 Not Found error, check that your Bitbucket Server URL is correct.
Data Cloud API
Once the initial connection is created successfully, credentials can be managed via the Data Cloud API. This connector uses the same credential fields as Bitbucket Data Center (settings.bitbucket_data_center_username and secrets.bitbucket_data_center_password).