JiraJira

需要“用户名”(用于登录的电子邮件地址)和 API 令牌才能连接到 Jira 。You need a Username (the email address you use to login) and API Token to connect to Jira. 令牌的行为类似于密码。The token behaves like a password.

Jira 数据源Jira data source

查询Query

对于简单查询,返回问题而不筛选:For a simple query, one that returns issues with no filtering:

{}

仅返回特定字段:Return only specific fields:

{
  "fields": "summary,priority"
}

仅返回特定字段并按优先级筛选:Return only specific fields and filter by priority:

{
  "fields": "summary,priority",
  "jql": "priority=medium"
}

计算 priority=medium 的问题数:Count number of issues with priority=medium:

{
  "queryType": "count",
  "jql": "priority=medium"
}

还可使用字段映射为结果字段重命名,这在使用自定义字段时非常有用:You can also use the field mapping to rename a field for the result - this is useful when working with custom fields:

{
  "fields": "summary,priority,customfield_10672",
  "jql": "priority=medium",
  "fieldMapping": {
    "customfield_10672": "my_custom_field_name"
  }
}

JIRA 返回的某些字段是具有多个属性的 JSON 对象。Some fields returned by JIRA are JSON objects with multiple properties. 可定义一个字段映射,以选择要返回的特定成员属性(在此示例中为“priority”字段的“id”成员):You can define a field mapping to pick a specific member property you want to return (in this example ‘id’ member of the ‘priority’ field):

{
  "fields": "summary,priority",
  "jql": "priority=medium",
  "fieldMapping": {
    "priority.id": "priority"
  }
}

下面是一个合并了不同筛选器选项的更复杂的示例:Here’s a more complex example combining the different filter options:

{
  "fields": "summary,priority,customfield_10672,resolutiondate,fixVersions,watches,labels",
  "jql": "project = MYPROJ AND resolution = unresolved ORDER BY priority DESC, key ASC",
  "maxResults": 30,
  "fieldMapping": {
    "customfield_10672": "my_custom_field_name",
    "priority.id": "priority",
    "fixVersions.name": "my_fix_version",
    "fixVersions.id": "my_fix_version_id"
  }
}

如果字段包含值列表,则返回的所有值都用“,”串联。If a field contains a list of values all are returned concatenated with “,”.