GitLab to JSM Assets
GitLab to JSM Assets Integration Guide
This page explains how to use OnLink to import project (repository) data from GitLab into Jira Service Management Assets.
Overview
OnLink imports GitLab REST API responses into Jira Service Management Assets object types using mapping statements such as key:, map:, and config:. Use this pattern for GitLab resources such as projects, groups, users, and members. This works for both GitLab.com and GitLab Self-Managed / Dedicated instances.
The high-level process is:
Create or confirm the target Assets schema and object type (for example, GitLab Project).
Create a GitLab access token with the
read_apiscope.Configure an OnLink Assets Data Source that authenticates to GitLab with a bearer token.
Set the API method and GitLab endpoint, add filters, then fetch sample data.
Configure offset pagination so the full project list is retrieved.
Map JSON fields from the GitLab response to Assets attributes.
Run Get Data to validate the result, then run the import when the mapping is correct.
Prerequisites
A Jira Service Management Assets schema and object type for the data you want to import.
OnLink installed and available from Manage your apps.
A GitLab personal, group, or project access token with the
read_apiscope.Permission in JSM Assets to configure data sources, mappings, and imports.
Your GitLab API base URL:
https://gitlab.com/api/v4for GitLab.com, orhttps://<your-gitlab-host>/api/v4for Self-Managed.
Supported GitLab object types
The examples on this page use GitLab project data from the Projects API. The same pattern can be adapted for other GitLab resources, such as groups (/groups), users (/users), and project members (/projects/:id/members), by selecting the appropriate API endpoint and mapping the returned JSON fields to the matching Assets attributes.
1. Create the GitLab access token
GitLab supports several REST API authentication methods. For scheduled OnLink imports, use a personal access token, group access token or OAuth 2.0 access token.
Option A – Group access token (recommended for organizations)
In GitLab, open the top-level group that contains the projects you want to import.
Go to Settings > Access tokens and select Add new token.
Enter a name (for example,
onlink-assets-sync) and an expiration date.Set the role to Reporter (or higher if you plan to import project statistics).
Select the read_api scope.
Create the token, then copy and securely store it.
Option B – Personal access token
In GitLab, select your avatar > Edit profile > Access tokens > Add new token.
Enter a name and expiration date, select the read_api scope, and create the token.
Copy and securely store the token. The import will only see projects this user can access.
Group access tokens are available on GitLab Self-Managed (all tiers) and on GitLab.com Premium and Ultimate. On GitLab.com Free, use a personal access token from a dedicated service user.
Use the token generated above in the OnLink connection.
2. Configure the OnLink data source
In OnLink, add an Assets Data Source.
Set Authentication Type to Bearer Token.
Set the header name to
Authorization.Paste the token generated in GitLab.
GitLab accepts personal, project, and group access tokens in the OAuth-compliant header, so the request is sent as:
Authorization: Bearer <your_access_token>3. Configure the API method
Use a GET request to retrieve records from the GitLab List all projects API. For example, to fetch projects, configure the request as follows:
Set Method to
GET.Set URL to
https://gitlab.com/api/v4/projectsLeave Response data path empty.
Leave the remaining configuration at the default values unless your GitLab endpoint requires additional parameters.
GET https://gitlab.com/api/v4/projects?membership=trueOn GitLab.com, GET /projects without filters lists every project visible to the token, including public projects across all of GitLab.com. Always add membership=true, or use the group endpoint below, so you only import your organization’s projects.
Alternative: import all projects in a group
To import every project in a group and its subgroups, use the group projects endpoint with the group ID or URL-encoded group path:
GET https://gitlab.com/api/v4/groups/<group_id>/projects?include_subgroups=true4. Fetch sample data
Save the connection, then run it to fetch sample values from GitLab. Use the returned sample JSON to confirm that the endpoint is correct and to identify the field names needed for mapping.
When inspecting the sample response, look for the field path that contains the value you want to import. For example, the project path appears as path_with_namespace, while the group it belongs to is nested under namespace (for example, namespace.full_path).
5. Configure offset pagination
The List all projects endpoint returns a paginated list. GitLab supports offset-based pagination for up to 50,000 projects, which covers most organizations.
Parameter / header | Purpose |
|---|---|
| Page number to return. Starts at |
| Number of records per page. Default is |
| Next page number. Empty on the last page. |
| Total number of records and pages. These may be omitted for very large result sets, so do not rely on them alone. |
In the OnLink data source:
Set the pagination type to Offset / page number.
Set the page parameter to
page, starting at1.Set the page size parameter to
per_pagewith a value of100.Set Max pages to cover your expected project count (for example, 10 pages × 100 = 1,000 projects). Increase it if you have more projects.
Pagination stops when a page returns an empty array (
[]) orx-next-pageis empty.
Always add a stable sort order so records do not shift between pages while the import runs:
GET https://gitlab.com/api/v4/projects?membership=true&order_by=id&sort=asc&per_page=100&page=1If you need more than 50,000 projects, switch to GitLab keyset pagination (pagination=keyset&order_by=id&sort=asc) and follow the Link response header. See GitLab pagination.
6. Apply filtering
You can refine results by adding query parameters to the URL. Useful filters for the List all projects endpoint include:
Filter | Example | Use |
|---|---|---|
|
| Only projects the token user is a member of. Recommended on GitLab.com. |
|
| Exclude archived projects. |
|
| Only projects that are not archived and not marked for deletion. |
|
| Limit to |
|
| Only projects where the token user has at least this role (30 = Developer, 40 = Maintainer, 50 = Owner). |
|
| Only projects with activity after this ISO 8601 date. Useful for excluding stale repositories. |
|
| Incremental syncs. Requires |
|
| Match project name, path, or description (case-insensitive). |
|
| Only projects tagged with all listed topics. |
|
| Only projects using the given language. |
|
| Adds repository size and commit count. Requires Reporter role or higher. |
For example, to import only active private projects you are a member of:
GET https://gitlab.com/api/v4/projects?membership=true&active=true&visibility=private&order_by=id&sort=asc&per_page=1007. Configure the Assets import and mapping
After the connection is established, create the Assets import by following the JSM Assets Data Synchronization guide.
Use the fetched API sample to identify the GitLab JSON field names and map them to the corresponding JSM Assets attributes. The key: mapping should identify the stable unique value used to match and update existing Assets objects. Use the numeric project id, because project names and paths can change when a project is renamed or transferred.
Suggested GitLab Project object type
Mapping or setting | Assets attribute type | Purpose and usage |
|---|---|---|
| Integer | The |
| Text (label) | The |
| Text | Full project path, for example |
| Textarea | Project description. |
| URL | Link to open the project in GitLab. |
| Text | HTTPS clone URL of the repository. |
| Select (Private, Internal, Public) | Supports security reviews, for example finding public repositories. |
| Text | Default branch, for example |
| Boolean | Whether the project is archived. |
| Boolean | Flags projects with no code, useful for cleanup. |
| DateTime | When the project was created. |
| DateTime | Last project activity. GitLab updates this at most once per hour. |
| Integer | Number of open issues. |
| Integer | Popularity and reuse indicators. |
| Text | Group or user namespace that owns the project. Values are nested under |
| Object reference (GitLab Group) | Creates a reference to a GitLab Group object whose |
| Object reference (GitLab User) | Links the project to the GitLab User object that created it. Import users first from |
| Object reference, multiple | Maps array values from |
| Integer | Repository size in bytes. Only returned when the URL includes |
Sample JSON Response
[
{
"id": 4,
"description": "string",
"name": "string",
"name_with_namespace": "string",
"path": "string",
"path_with_namespace": "string",
"created_at": "2026-01-15T13:46:02Z",
"updated_at": "2026-10-30T09:12:44Z",
"default_branch": "main",
"topics": [
"string"
],
"ssh_url_to_repo": "string",
"http_url_to_repo": "string",
"web_url": "string",
"readme_url": "string",
"avatar_url": "string",
"forks_count": 0,
"star_count": 0,
"last_activity_at": "2026-10-30T17:11:26.841Z",
"visibility": "private",
"namespace": {
"id": 3,
"name": "string",
"path": "string",
"kind": "group",
"full_path": "string",
"parent_id": null,
"avatar_url": "string",
"web_url": "string"
},
"empty_repo": false,
"archived": false,
"creator_id": 1,
"open_issues_count": 0,
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"jobs_enabled": true,
"shared_runners_enabled": true,
"lfs_enabled": true,
"import_status": "none",
"compliance_frameworks": [],
"statistics": {
"commit_count": 0,
"storage_size": 0,
"repository_size": 0
},
"_links": {
"self": "string",
"issues": "string",
"merge_requests": "string",
"repo_branches": "string",
"members": "string"
},
"permissions": {
"project_access": null,
"group_access": null
}
}
]Mapping guidance
Start with one unique
key:mapping (id) so OnLink can identify whether to create or update an Assets object.Add
map:entries for each GitLab field you want to store in Assets.Compare the GitLab sample JSON with the Assets object type attributes before running an import.
Fields returned can vary with the token’s role. Some fields only appear for Maintainers or Owners, and
simple=truereturns a reduced field set, so confirm fields in the sample response before mapping them.If a value is nested in the JSON response (for example,
namespace.full_path), inspect the sample output carefully and use the field path supported by the OnLink mapping configuration.
8. Validate and run the import
Use Get Data first to preview the data returned by GitLab.
Confirm that the sample records contain the expected fields and values, and that only your organization’s projects are returned.
Verify that the key field maps to a unique Assets attribute.
Check the record count against GitLab to confirm pagination retrieved every page.
Review the object type mapping and attribute names for spelling and case consistency.
Run the import only after the previewed data and mapping are correct.
Troubleshooting
Response | Likely cause and fix |
|---|---|
| Token is missing, expired, or revoked. Create a new token and update the data source. |
| Token lacks the required scope. Recreate it with |
| GitLab rate limit reached. Reduce Max pages or the sync frequency, and use |
Thousands of unexpected projects | The URL is missing |