Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I archive an issue using the jira-python library?

Jeff Shepherd
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 9, 2025 edited

I am using the jira 3.10.1.dev4 jira-python library interacting with my Jira Server 9.12 cluster. I have a set of issues created from a jira.search_issues() call. I would like to archive them.  I don't see a specific jira.archive() call that would seem to be most appropriate. The Jira REST call would be PUT /rest/api/2/issue/{issueIdOrKey}/archive (single) or POST /rest/api/2/issue/archive (multiple).

How do I archive the issues using the jira-python library?

 

3 answers

1 accepted

0 votes
Answer accepted
Jeff Shepherd
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2025

I had to write my own wrapper around the `jira-python` library

from jira import JIRA

class MyJIRA(JIRA):
'''Inheriting from jira-python library'''
def archive_issue(self, issue: int | str) -> bool:
url = self._get_latest_url(f"issue/{issue}/archive")
self._session.put( url )
return True

myJira = MyJIRA(basic_auth=(jira_username, jira_password), server=jira_server)
myJira.archive_issue('ABC-1234')
0 votes
Piyush Annadate _ACE Pune_
Community Champion
May 9, 2025

Hello @Jeff Shepherd ,
Checkout https://support.atlassian.com/jira/kb/is-there-an-easy-way-to-archive-a-lot-of-issues/ - this had update ~months in past.

Else, API  via post method can be done, PUT /rest/api/2/issue/{issueIdOrKey}/archive but that would be per issue basis.

Jeff Shepherd
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2025

Thank you for your response. I have used that Jira KB article in the past. For some reason it stopped working for me and I was hoping to transition my code to the jira-archive library, which has been easier for me to understand.

Is there a way to use jira-archive to access the post method? Somehow sending the /rest/api/2/issue/{issueIdOrKey}/archive to, say jira.resources.update() or jira.resources.Resource()?

0 votes
Lucas Modzelewski _Lumo_
Atlassian Partner
May 9, 2025

You can check what Chat GPT suggests or search through more technical developer community: https://community.developer.atlassian.com/ 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.12.18
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events