15

有没有办法让我获得史诗般的问题?

api 返回很多关于问题的信息,但不包括史诗。

我正在使用 JIRA REST API ( https://developer.atlassian.com/display/JIRADEV/JIRA+REST+APIs )。

4

4 回答 4

20

我想提取一个史诗般的名字,issue这让我难过了几天。关键是要意识到 anepic只是一个父问题,而史诗名称summary父字段issue

所以:

第1步

使用查询查找存储史诗的自定义字段editmeta

https://[your-jira-hostname]/jira/rest/api/2/issue/[issue-number]/editmeta

这将产生类似下面的内容,显示我们需要的自定义字段 ID

{
  "fields": {
    <SNIP>
    "customfield_12360": {
      "required": false,
      "schema": {
        "type": "any",
        "custom": "com.pyxis.greenhopper.jira:gh-epic-link",
        "customId": 12360
      },
      "name": "Epic Link",
      "operations": [
        "set"
      ]
    }
    <SNIP>
  }
}

第2步

查询你的问题,拉出自定义字段值

https://[your-jira-hostname]/jira/rest/api/2/issue/[issue-number]?fields=customfield_12360,summary

如果我们的问题是JIRA-34,这将产生类似

{
  "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
  "id": "39080",
  "key": "JIRA-34",
  "fields": {
    "summary": "Write heavily upvoted answers for stack overflow",
    "customfield_12360": "JIRA-33"
  }
}

第 3 步

现在我们知道我们的史诗的问题编号是JIRA-33,所以现在查询史诗......

https://[your-jira-hostname]/jira/rest/api/2/issue/JIRA-33?fields=summary

{
      "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
      "id": "39080",
      "key": "JIRA-33",
      "fields": {
        "summary": "Improve StackOverflow reptuation"
      }
    }

史诗的名称JIRA-34是“提高 StackOverflow 信誉”

完毕。

于 2017-06-09T00:45:01.807 回答
2

要获取问题的史诗密钥:

发送请求到:/issue/ISSUE-NUMBER

并查看响应正文:

{
    ...,
    fields: {
        ...,
        customfield_11300: ... <- here, the epic should be listed. The number can be different
    }
}
于 2014-06-25T13:30:12.213 回答
0

@fiat 有非常明确的步骤来查找自定义字段和史诗映射。在我的场景中,整个 jira 实例使用与史诗相同的自定义字段。所以我不需要重复这些步骤来映射每个项目。希望这会有所帮助。

于 2018-03-13T10:04:56.013 回答
0

根据https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/,您可以对 进行API调用/rest/api/3/field,然后您可以获得如下数据:

[
  {
    "id": "customfield_10014",
    "key": "customfield_10014",
    "name": "Epic Link",
    "untranslatedName": "Epic Link",
    "custom": true,
    "orderable": true,
    "navigable": true,
    "searchable": true,
    "clauseNames": [
      "cf[10014]",
      "Epic Link"
    ],
    "schema": {
      "type": "any",
      "custom": "com.pyxis.greenhopper.jira:gh-epic-link",
      "customId": 10014
    }
  },
]

然后回头看看你的问题 json 数据:

issue:
  fields:
    ....
    customfield_10014: OT-5
    ....

OT-5是 Epic 的钥匙。

于 2021-01-08T06:29:58.157 回答