View all connectors

GitLab Merge Request Commits

By enabling the GitLab Merge Request Commits connector, you can import metadata on individual GitLab commits and incorporate commit data in the calculation of developer time spent on tasks. 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.

Before proceeding, please make sure that you have first enabled the GitLab connector by following the steps here. Each GitLab-related connection in DX should utilize a separate Group Access Token to avoid rate limit issues.

Prerequisites

To connect GitLab to DX, you need:

Setup instructions

Follow the steps below to connect GitLab Merge Request Commits to DX.

Step 1

Either create a Group Access Token with the Developer role and read_api scope, or create a group service account, add it to the group with the Developer role, and create an access token with the read_api scope.

Step 2

Grant the Group access to projects that you want to import.

Step 3

  • 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.
    • For GitLab-hosted instances, the API base URL should be https://gitlab.com/.

API reference

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

Endpoint Documentation
groups Link
groups/{groupId}/projects Link
projects/{projectId}/merge_requests Link
projects/{projectId}/merge_requests/{mergeRequestId}/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 Your API token does not have access to any projects or repositories.

Curl commands

When DX verifies a GitLab Merge Request Commits connection, it checks if it can access groups, projects, merge requests, and commits. If your connection is failing, you can test these endpoints directly using the curl commands below to troubleshoot the issue.

Replace YOUR_ACCESS_TOKEN and YOUR_GITLAB_URL with your actual values before running these commands.

1. Test Groups Access

This verifies that your token can access group information:

curl -H 'PRIVATE-TOKEN: YOUR_ACCESS_TOKEN' -H 'Accept: application/json' 'YOUR_GITLAB_URL/api/v4/groups'

2. Test Group Projects Access

Replace GROUP_ID with a valid group ID to verify projects access:

curl -H 'PRIVATE-TOKEN: YOUR_ACCESS_TOKEN' -H 'Accept: application/json' 'YOUR_GITLAB_URL/api/v4/groups/GROUP_ID/projects'

3. Test Merge Requests Access

Replace PROJECT_ID with a valid project ID to verify merge requests access:

curl -H 'PRIVATE-TOKEN: YOUR_ACCESS_TOKEN' -H 'Accept: application/json' 'YOUR_GITLAB_URL/api/v4/projects/PROJECT_ID/merge_requests?order_by=created_at&sort=desc'

4. Test Merge Request Commits Access

Replace PROJECT_ID and MERGE_REQUEST_IID with valid IDs to verify merge request commits access:

curl -H 'PRIVATE-TOKEN: YOUR_ACCESS_TOKEN' -H 'Accept: application/json' 'YOUR_GITLAB_URL/api/v4/projects/PROJECT_ID/merge_requests/MERGE_REQUEST_IID/commits'

If you receive a 401 Unauthorized error, your credentials are invalid. If you receive a 403 Forbidden error, your token doesn’t have the required permissions. If you receive a 404 Not Found error or empty results, check that your GitLab URL and project/merge request IDs are correct.

Note about Authentication: The PRIVATE-TOKEN header is the standard authentication method for GitLab API requests. Make sure your Group Access Token has the read_api scope enabled.

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 GitLab (secrets.api_token).