我正在使用 Jira Rest API,我想读取父/子层次结构。为此,我读入顶部元素,然后想通过子任务从 JSON 重新加载子元素。不幸的是,子任务总是空的 - 即使使用参数
?expand=children
也不行。
另请参阅:如何使用 api rest 中的 GET 方法获取 gira 问题的所有子项
这是我的 API 调用:https://jira.mydomain.de/rest/api/2/issue/CANVAS15-219?expand=children。
附上Jira中问题的截图。在那里你可以看到四个子元素:
我需要做什么才能通过 Rest API 读取子元素?
JSON 响应(缩写):
{
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"id": "6943669",
"self": "https://jira.mydomain.de/rest/api/2/issue/6943669",
"key": "CANVAS15-219",
"fields": {
"customfield_48448": null,
...
"customfield_48478": null,
"subtasks": [],
"customfield_48475": null,
...
"customfield_12810": null
}
}
史诗没有子任务。子任务存在于其问题中,而在 UI 中显示为史诗的“子问题”的内容实际上是顶级问题项目本身。
因此,要查找给定史诗下的所有问题,您必须使用“Epic Link”字段(这是一个自定义字段,您必须查找其 ID,以便将其转换为 JSON 字段)查询所有问题姓名)。然后你可以这样做来查找史诗下的问题:
/rest/api/3/search?jql=customfield_xxxxx=CANVAS15-219