Skip to main content
Version: Next

Gitlab

Gitlab source connector

Description

The Gitlab source connector reads data from the GitLab REST API. It is built on the HTTP source connector, and automatically sends access_token as the GitLab PRIVATE-TOKEN request header.

Key features

Options

nametyperequireddefault value
urlStringYes-
access_tokenStringYes-
methodStringNoGET
headersMapNo-
paramsMapNo-
bodyStringNo-
formatStringNotext
schemaConfigNo-
schema.fieldsConfigNo-
json_fieldConfigNo-
content_fieldStringNo-
pageingConfigNo-
poll_interval_millisintNo-
retryintNo-
retry_backoff_multiplier_msintNo100
retry_backoff_max_msintNo10000
json_filed_missed_return_nullbooleanNofalse
common-optionsconfigNo-

url [String]

GitLab REST API URL, for example https://gitlab.com/api/v4/projects.

access_token [String]

GitLab personal access token. The connector sends it in the HTTP PRIVATE-TOKEN header.

method [String]

HTTP request method. The common GitLab read scenario uses GET.

headers [Map]

Extra HTTP headers. Do not put PRIVATE-TOKEN here unless you intentionally want to override the header generated from access_token.

params [Map]

HTTP query parameters, such as per_page, page, owned, or other GitLab API parameters.

body [String]

HTTP request body. This is only useful for API endpoints that accept a request body.

format [String]

Response format. Supports json and text. Use json with schema when you want SeaTunnel rows with named fields.

schema [Config]

Defines the output row structure when format = "json". For details, see Schema Feature.

json_field [Config]

Maps output fields to JSONPath expressions. Use it with schema when the required values are nested in the response.

content_field [String]

JSONPath expression used to select a JSON fragment before schema parsing, for example $.items[*].

pageing [Config]

Pagination settings inherited from the HTTP connector. Keep the option name pageing in job configs.

poll_interval_millis [int]

This option is inherited from the HTTP connector, but Gitlab source currently supports batch mode only.

retry [int]

Maximum retry count when an HTTP request fails with IOException.

retry_backoff_multiplier_ms [int]

Retry backoff multiplier in milliseconds.

retry_backoff_max_ms [int]

Maximum retry backoff in milliseconds.

json_filed_missed_return_null [boolean]

When true, missing JSON fields return null; otherwise a missing field causes an error.

common options

Source plugin common parameters. See Source Common Options.

Example

Read projects from GitLab:

source {
Gitlab {
url = "https://gitlab.com/api/v4/projects"
access_token = "glpat-xxxxxxxxxxxx"
method = "GET"
format = "json"
schema = {
fields {
id = int
description = string
name = string
name_with_namespace = string
path = string
http_url_to_repo = string
}
}
}
}

Read paged GitLab API results:

source {
Gitlab {
url = "https://gitlab.com/api/v4/projects"
access_token = "glpat-xxxxxxxxxxxx"
method = "GET"
params = {
per_page = "100"
page = "${page}"
}
pageing = {
page_field = "page"
total_page_size = 5
start_page_number = 1
use_placeholder_replacement = true
}
format = "json"
schema = {
fields {
id = int
name = string
path = string
}
}
}
}

Changelog

Change Log
ChangeCommitVersion
[improve] http connector options (#8969)https://github.com/apache/seatunnel/commit/63ff9f910a2.3.10
[Feature][Connector-V2] Support TableSourceFactory/TableSinkFactory on http (#5816)https://github.com/apache/seatunnel/commit/6f49ec6ead2.3.4
[Improve][build] Give the maven module a human readable name (#4114)https://github.com/apache/seatunnel/commit/d7cd6010512.3.1
[Improve][Project] Code format with spotless plugin. (#4101)https://github.com/apache/seatunnel/commit/a2ab1665612.3.1
[Improve][Connector-V2][Http]Improve json parse option rule for all http connector (#3627)https://github.com/apache/seatunnel/commit/589e4161ec2.3.0
[Feature][Connector-V2][HTTP] Use json-path parsing (#3510)https://github.com/apache/seatunnel/commit/1807eb6c952.3.0
[Hotfix][OptionRule] Fix option rule about all connectors (#3592)https://github.com/apache/seatunnel/commit/226dc6a1192.3.0
[Improve][Connector-V2][Gitlab] Unified excetion for Gitlab connector and improve optione rule (#3533)https://github.com/apache/seatunnel/commit/77f68f1eef2.3.0
[Feature][Connector V2] add gitlab source connector (#3408)https://github.com/apache/seatunnel/commit/545595c6d22.3.0