dandavathis
dandavathis

Reputation: 1

resolve ticket as fixed with python jira api

import jira 
def resolve_issue(jira,issue):
    jira.transition_issue(issue, '5', assignee={'name': 'pm_user'}, resolution={'id': '3'},comment={'name':"Resolved the ticket."}))

[(u'5', u'Resolve Issue'), (u'821', u'Request Info'), (u'1011', u'Rejected'), (u'1031', u' Duplicate ')] 

are the available transitions. does not work to resolve an issue as fixed with python jira rest api. I have tried to list out the transitions, but I don't see 'fixed' resolution id. Any suggestions?

added error below

text: Can not deserialize instance of java.lang.String out of START_OBJECT token

at [Source: N/A; line: -1, column: -1] (through reference chain: com.atlassian.jira.issue.fields.rest.json.beans.CommentJsonBean["body"])

Upvotes: 0

Views: 2238

Answers (1)

darksideofthesun
darksideofthesun

Reputation: 621

I'm not sure if this is actually causing your problem but you have to wrap your 'assignee' and 'resolution' changes in a "fields" dict. So it would have to be something like:

fields = {
    "resolution:: {
        "id": "3"
    },
    "assignee: {
        "name": "pm_user"
    }
}
jira.transition_issue(issue, fields=fields, comment="Resolved the ticket.")

The JIRA REST API doesn't have very good error handling for transitions and I've seen a number of different errors (usually a 500) when the request is malformed.

Upvotes: 0

Related Questions