Forums

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

Python API retreive all ISSUES under an EPIC

Valentin Popov January 27, 2022

Hello to everyone,

i'm trying to retreive all isues under un EPIC using python API "Jira".

I've successfully get all issues including (Stories,Task,Bugs,Epics):

#get all issues for the prject
data1=jira_client.search_issues(f'project = \"{project_name}\"', startAt=i, maxResults=chunk_size, expand='changelog')

But i don't know how to associate Task/Bugs to un epic, i have tryed this solution from

https://community.atlassian.com/t5/Jira-questions/Query-to-find-all-issues-related-to-an-EPIC-including-subtasks/qaq-p/871457

but it does not worked, data2 has only one object (a epic itself 'DATA-580')

data2 = jira_client.search_issues("project = \"Data\"  AND \"Epic Link\" = DATA-580 OR parentEpic = DATA-580")

 Any idea?

2 answers

1 accepted

1 vote
Answer accepted
Pramodh M
Community Champion
January 28, 2022

Hi @Valentin Popov 

Welcome to the Community!!

Use the below Python wrapper to 

https://atlassian-python-api.readthedocs.io/index.html

Do a  pip install atlassian-python-api

And save the file and run

from atlassian import Jira

jira = Jira(

    url='https://your-site.atlassian.net',
    username='email',
    password='token',
    cloud=True)

jql_request = '"parentEpic" = DATA-580'
issues = jira.jql(jql_request)
print(issues)

This will work for sure

Make sure you extract the data since it returns every issue data

Mark the answer as accepted

Thanks,
Pramodh

Valentin Popov February 1, 2022

Thank you so much @Pramodh M

I have tried the sugested library, but still cant see the reletad issues of an epic. For example, for another epic DATA-800 from Jira web page - advanced issue search i see 9 "child tickets".

"parentEpic" = DATA-800

But via code i still receive a one issue (EPIC DATA-800) with inside no info about subtasks or some thing related to issues in epic. I have :

  • 'customfield_10018'  ->{'reason': 'PLUGIN_LICENSE_ERROR', 'message': 'Il link padre è disponibile solo per utenti Jira Premium.'}
  • 'issuelinks' is empty
  • 'subtasks' is empty
issues = jira.jql(jql_request)

Like Barbara Szweda likes this
Pramodh M
Community Champion
February 1, 2022
from atlassian import Jira
jira = Jira(
    url='https://your-site.atlassian.net',
    username='email',
    password='token',
    cloud=True)

jql_request = '"epic link" = WSPD-144'
issues = jira.jql(jql_request)
print(issues)

How about this!!

I am correctly getting the data :-)

Please check with other Epic Issue or may I get the screenshot of how you are getting the issue data?

Thanks

Valentin Popov February 1, 2022

Thank you, it's working just last question how can i query more than 50 issues from? 

jql_request = 'project = DATA'
issues = jira.jql(jql_request)

 and i also need a expand a change log... my old code was :

chunk = jira_client.search_issues(f'project = \"{project_name}\"', startAt=i, maxResults=chunk_size, expand='changelog')
Like Valentin Popov likes this
0 votes
Jay Wang
Contributor
June 21, 2022
jql_request = '"parentEpic" = DATA-580'
issues = jira.jql(jql_request)
print(issues)

This idea helps me. I used multiple sections: 1st pulls the entire issues with 20 or so columns, 2nd extract from 1st unique epic number; 3rd loop through 2nd to extract issue number and epic number (use your idea); 4th left join 1st and 3rd to add epic number; 5th save to sql table.  

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events