I am trying to build a data with hierarchy as parent-child and intiative-epic-story,
I have created multiple tables, one of those tables is issuelinktype for now I am getting all the relations like below
but I also want these to be there
I checked and found that there is not data where there is parent-child link I am currently using this logic to extract data
def fetch_jira_tickets(target_url, target_username, target_password, project, include_comments, include_description, fields):
# Define the Jira API endpoint for searching issues
api_endpoint = f"{target_url}/rest/api/2/search"
# Set up basic authentication with username and password
auth = (target_username, target_password)
# Set up JQL (Jira Query Language) to search for issues in the specified project
jql = f"project={project}"
# Set the maximum number of issues per request (can be adjusted based on your requirements)
max_results = 100
# Initialize an empty list to store the ticket information
tickets_info = []
# Paginate through the Jira API to retrieve all the issues for the project
start_at = 0
while True:
params = {
"jql": jql,
"startAt": start_at,
"maxResults": max_results,
# "fields": fields or "summary,issuetype,assignee" # Include all fields if fields is None
"fields": fields or "*all" # Include all fields if fields is None
}
# Set urllib3 logger to ERROR level to suppress SSL warnings
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
response = requests.get(api_endpoint, params=params, auth=auth, verify=False)
if response.status_code != 200:
raise Exception(f"Failed to fetch issues for project '{project}'. Status code: {response.status_code}")
data = response.json()
tickets_info.extend(data['issues'])
if data['total'] <= start_at + max_results:
break
start_at += max_results
# Filter ticket information to include/exclude comments and description
if not include_comments:
for ticket in tickets_info:
if 'comment' in ticket['fields']:
del ticket['fields']['comment']
if not include_description:
for ticket in tickets_info:
if 'description' in ticket['fields']:
del ticket['fields']['description']
return tickets_info