我正在尝试编写一个允许用户使用json关闭JIRA问题的方法。 这是我正在使用的网址:
../jira/rest/api/latest/issue/MyProj-524/transitions
这是我的json字符串:
{ "update" : {"comment": [{"add": {"body":"Fixed"}}]}, "fields" : { "resolution" : {"id":"10000","name":"Done" }}, transition": {"id": "6"}}
我收到400异常(错误请求)和ProtocolError状态。根据文档400,如果没有指定转换,将返回。
当我用浏览器从浏览器查询JIRA服务器时
..:8090/jira/rest/api/latest/issue/MyProj-524/transitions
我得到以下内容:
{"expand":"transitions","transitions":[{"id":"5","name":"Resolve Issue","to":{"self":"/jira/rest/api/2/status/5","description":"A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.","iconUrl":"..8090/jira/images/icons/statuses/resolved.png","name":"Resolved","id":"5","statusCategory":{"self":"...8090/jira/rest/api/2/statuscategory/3","id":3,"key":"done","colorName":"green","name":"Done"}}},{"id":"2","name":"Close Issue","to":{"self":".:8090/jira/rest/api/2/status/6","description":"The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.","iconUrl":"..8090/jira/images/icons/statuses/closed.png","name":"Closed","id":"6","statusCategory":{"self":"8090/jira/rest/api/2/statuscategory/3","id":3,"key":"done","colorName":"green","name":"Done"}}}]}
所以似乎有可用的转换。我们正在使用“经典默认工作流程”,其中包含:打开,已解决,已关闭,已重新打开和正在进行中。票证的当前状态是:打开。
答案 0 :(得分:0)
您确定使用的是正确的转换ID吗?你有没有检查
... / JIRA / REST / API /最新/问题/的Myproj-524 /转换?扩大= transition.fields
您的ID应与您要转换为的转化相匹配。在我的情况下(使用Jira云附带的标准转换,我的ID为31(“完成”)
您可能还想确认您的工作流程允许从“打开”到“已关闭”处理问题。您可以在Admin>中查看此图表。问题>工作流程>分配的方案>以图表形式查看
这里还有一些建议:
https://answers.atlassian.com/questions/86247/how-can-i-close-an-issue-via-a-rest-api-call