rkm
rkm

Reputation: 67

Removing Jira issues through Python script

We have jirapython integration library. We create issue through python script.like create_issue. But same as i want remove issue function. I referred many docs,blogs and official site. But i did not get this solution. Can anyone pls help me this issue.

Upvotes: 2

Views: 4005

Answers (1)

Philip DiSarro
Philip DiSarro

Reputation: 1025

This is pretty trivial. If you want to delete an issue, you need the issue object. One way to obtain the object is via jira.create_issue() function that you mentioned in which case you can delete it as follows:

issue = jira.create_issue(...)
...
issue.delete()

Alternatively if you happen to know the ID of the issue you want to delete you could delete it like so:

issue = jira.issue("EXAMPLE-244")
issue.delete()

If you don't know the IDs of the issues you want to delete, you might first have to find the issues via the jira.search_issues() function. This would look like:

issues = jira.search_issues('project="%s" AND summary~"%s"' % ("project_key", "issue title"), maxResults=100)

for issue in issues:
    issue.delete()

Upvotes: 4

Related Questions