Search code examples
jirajira-rest-api

Transitioning Jira Issue with resolution


I want to transition a jira issue to done and put a resolution along with it.

I am using the POST /rest/api/2/issue/{issueIdOrKey}/transitions REST call.

Sample input according to documentation:

{
    "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"
        }
    }
}

Now I'm only interested in the fields transition and resolution. My sample input is :

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

I'm getting a 400 with the following error:

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

Can someone please point me what I'm missing?

UI to show the resolutions options.


Solution

  • Seems that the status that matches the ID 1 is not the status "Done" that should accept, in your screen, the resolutions you're trying to set.