跳到主要内容
版本:3.0.0

Jira

Jira 源连接器

描述​

用于从 Jira REST API 读取数据。连接器会根据 email 和 api_token 自动生成 Jira Basic 认证请求头,然后复用 HTTP Source 的能力解析返回结果。

关键特性​

提示

Jira Source 只支持批处理。如果作业以流模式运行,连接器会报错。

选项​

名称类型是否必填默认值说明
urlString是-Jira REST API 地址。
emailString是-用于 Basic 认证的 Jira 账号邮箱。
api_tokenString是-用于 Basic 认证的 Jira API Token。
methodString否GETHTTP 请求方法,支持 GET 和 POST。
headersMap否-额外的 HTTP 请求头。除非需要覆盖自动生成的 Jira 认证头,否则不要在这里配置 Authorization。
paramsMap否-HTTP 查询参数。
bodyString否-HTTP 请求体,通常和 POST 一起使用。
formatString否TEXT返回内容格式。如果要用 schema、json_field 或 content_field 解析 JSON,请设置为 json。
schemaConfig否-输出字段结构。format = "json" 时必须配置。
json_fieldConfig否-用 JSONPath 把返回字段映射到输出列,必须和 schema 一起使用。
content_fieldString否-用 JSONPath 选出需要按行解析的数组或对象。
pageingConfig否-分页配置,见 分页。
poll_interval_millisint否-轮询间隔,单位毫秒。Jira Source 只支持批处理,因此这个配置不适用于 Jira 流作业。
retryint否-请求出现 IOException 时的最大重试次数。
retry_backoff_multiplier_msint否100重试退避时间倍数,单位毫秒。
retry_backoff_max_msint否10000最大重试退避时间,单位毫秒。
json_filed_missed_return_nullboolean否falsejson_field 中配置的字段缺失时,是否返回 null。
common-optionsconfig否-源连接器通用配置,见 源通用选项。

认证​

在 Atlassian 账号中创建 Jira API Token 后,配置:

  • email:Jira 账号邮箱。
  • api_token:Jira API Token。

连接器会自动生成 Basic 认证请求头。

返回结果解析​

format 默认值是 TEXT,会把完整响应作为一个 content 字段输出。

如果需要结构化输出,请配置 format = "json" 和 schema:

format = "json"
schema = {
fields {
expand = string
startAt = int
maxResults = int
total = string
}
}

如果行数据在嵌套 JSON 节点里,用 content_field 选出对应节点。如果输出列需要从不同 JSONPath 中提取,用 json_field。

分页​

目标 API 需要分页参数时,可以配置 pageing。

名称类型是否必填默认值说明
total_page_sizelong否0请求的总页数。
batch_sizeint否100每次请求返回的数据条数。
start_page_numberlong否1起始页码。
page_fieldString否page页码分页时,请求参数中的页码字段名。
page_typeString否PageNumber分页类型,支持 PageNumber 和 Cursor。
cursor_fieldString否-游标分页时,请求参数中的游标字段名。
cursor_response_fieldString否-从响应中读取下一页游标的 JSONPath 字段。
use_placeholder_replacementboolean否false是否在请求头、参数和请求体中使用 ${field} 占位符替换。

示例​

env {
parallelism = 1
job.mode = "BATCH"
}

source {
Jira {
plugin_output = "jira"
url = "https://example.atlassian.net/rest/api/3/search"
email = "admin@example.com"
api_token = "replace-with-token"
method = "GET"
format = "json"
schema = {
fields {
expand = string
startAt = int
maxResults = int
total = string
}
}
}
}

sink {
Console {
plugin_input = "jira"
}
}

变更日志​

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
[Feature][Connector-V2][Jira]Add Jira source connector (#3473)https://github.com/apache/seatunnel/commit/fb40162c072.3.0