2017-08-02 107 views
2

我想将jira问题转换为完成并将其与解决方案一起使用。Jira问题与分辨率问题

我正在使用POST /rest/api/2/issue/{issueIdOrKey}/transitions REST调用。根据文档

样品输入:

{ 
    "update": { 
     "comment": [ 
      { 
       "add": { 
        "body": "Bug has been fixed." 
       } 
      } 
     ] 
    }, 
    "fields": { 
     "assignee": { 
      "name": "bob" 
     }, 
     "resolution": { 
      "name": "Fixed" 
     } 
    }, 
    "transition": { 
     "id": "5" 
    }, 
    "historyMetadata": { 
     "type": "myplugin:type", 
     "description": "text description", 
     "descriptionKey": "plugin.changereason.i18.key", 
     "activityDescription": "text description", 
     "activityDescriptionKey": "plugin.activity.i18.key", 
     "actor": { 
      "id": "tony", 
      "displayName": "Tony", 
      "type": "mysystem-user", 
      "avatarUrl": "http://mysystem/avatar/tony.jpg", 
      "url": "http://mysystem/users/tony" 
     }, 
     "generator": { 
      "id": "mysystem-1", 
      "type": "mysystem-application" 
     }, 
     "cause": { 
      "id": "myevent", 
      "type": "mysystem-event" 
     }, 
     "extraData": { 
      "keyvalue": "extra data", 
      "goes": "here" 
     } 
    } 
} 

现在我只是在田里过渡和分辨率感兴趣。我的样品输入:

{ 
    "fields": { 
     "resolution": { 
      "name": "Done" 
     } 
    }, 
    "transition": { 
     "id": "1" 
    } 
} 

我得到一个400,出现以下错误:

{ 
    "errorMessages": [], 
    "errors": { 
    "resolution": "Field 'resolution' cannot be set. It is not on the appropriate screen, or unknown." 
    } 
} 

可有人请指出我我缺少的是什么?

UI to show the resolutions options.

+0

您的屏幕中是否有“完成”分辨率? –

+0

是的,我确实有解决方法“完成”。新增了一张图片。 @RobertoRusso –

+1

ID 1是否与状态“完成”匹配? –

回答

1

似乎与ID 1匹配的状态不是状态“完成”,您应该在屏幕上接受您尝试设置的解决方案。

0

分辨率状态是两回事。 完成是根据您要发送的转换ID将问题转换到的(默认)状态。 分辨率只是一个字符串,一个自定义字段,其值可以在屏幕上更改..根据错误,您不需要在该项目中指定一个错误。

+0

我了解状态和分辨率不一样。我的状态通过''transition'正确设置:{ “id”:“1” }'。问题在于设置分辨率。 Isnt'“fields”:{ “resolution”:{ “name”:“Done” } },'足以设置分辨率吗? –