I am trying to split a project from an existing JIRA instance. I have been provided with a XML backup, which I have restored. New clone is running JIRA 6.2.2.
There are 117 Projects in the clone, and I only want to keep 1. I started deleting them manually, and that works, but is tedious, and since I'll be doing this again later, once I have worked out the steps involved, it is going to be easier to automate this.
The JIRA REST API seems to be the answer to all of my problems. I decided to use it via python, so installed jira-python via pip.
I can list out all of the projects. I can identify the one I want to keep, and when I try to delete those I don't wish to keep, it doesn't fail, but, neither does it delete the projects?
I have tried reindexing after deleting the Projects, but that made no change.
from jira.client import JIRA jira = JIRA(options = {'server': 'http://atsapaud02.toll.com.au:9090'}, basic_auth=('username', 'password')) # Get all Projects projects = jira.projects() # delete those Projects that are NOT required for project in projects: if project.key == 'TOL': print 'Leaving', project.key, '==>', project.name else: print 'Deleting', project.key, '==>', project.name, print jira.delete_project(project.key)
The JIRA REST documentation (https://docs.atlassian.com/jira/REST/6.2.2/) doesn't indicate that deleting a Project is available. It appears the only parts of Projects that can be deleted programmatically is the avatar, properties and roles.
The JIRA Python documentation (http://jira-python.readthedocs.org/en/latest/) on the other hand, lists a delete_project method, which returns False if it fails. In my case, it returns true, yet the Projects still exist.
Community moderators have prevented the ability to post new answers.
Peter, the delete_project() was implemented using normal HTTP calls inside the JIRA library. Mainly it works more like the browser. If I remember well removal of projects can take a lot of time and it does run in the background. So a False response could mean that deletion was not finished yet, or it failed for some reason.
another failure by atlassian. api is just a second class citizen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
REST does not currently support delete project, or in fact, most admin actions - https://docs.atlassian.com/jira/REST/6.2.2/ is the right place to look.
I'm not sure why the python docs don't tell you that to be honest. They're either aspirational or they're using an additional addon that provides more REST functions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.