Can somebody please share a sample of python script on how to perform bulk removal of links in Jira.
Hello there, Ahsan!
If you're talking about removing issue links, you can use the following Python script that uses the "requests" library.
import requestsbase_url = "<base_url>"delete_link = "/rest/api/2/issueLink/{0}"jql = "project=<project_name>" # You can use any jql you want to get the issues.jql_search_issues = "/rest/api/2/search?jql={0}".format(jql)issues = requests.get(base_url+jql_search_issues, auth=('user', 'pass')).json()issue_links = [[link['id'] for link in issue['fields']['issuelinks']] for issue in issues['issues']]for links in issue_links:if len(links) != 0:for link_id in links: delete = requests.delete(base_url+delete_link.format(link_id), auth=('user', 'pass'))print(delete.status_code, delete.content)
The script gets a list of issues based on a JQL, then it deletes all issue links from those issues.
Let me know if you have any questions.
It looks like you're new here. Sign in or register to get started.