2

How can I list all the issues within a project in Jira?

I am able to list all the projects, but not sure how to list all issues within a project.

This is how I list all the projects:

#/usr/bin/python
import jira.client
from jira.client import JIRA

options = {'server': 'http://jira.confluence.no' }
jira = JIRA(options, batch_auth=('admin', 'admin'))
project = jira.projects()
print project
Selcuk
  • 57,004
  • 12
  • 102
  • 110

1 Answers1

2

You can use .search_issues() method:

...
projects = jira.projects()
for project in projects:
    issues = jira.search_issues('project=' + project.key)
    for issue in issues:
        print issue
Selcuk
  • 57,004
  • 12
  • 102
  • 110
  • Thanks that did work. However its keep looping and printing the same values over again. –  Jun 09 '16 at 12:45
  • 1
    Did you double check that you wrote `print issue` and not `print issues`? – Selcuk Jun 09 '16 at 13:00
  • Ah! true. How can I list the creation and resolved time for each issue? –  Jun 09 '16 at 13:47
  • I guess you can access it using `issue.created`. – Selcuk Jun 10 '16 at 00:58
  • I double checked. I have `print issue` and not `print issues` what is the error? –  Jun 10 '16 at 08:13
  • Hm, it works fine for my test case, no idea what the problem is. – Selcuk Jun 11 '16 at 06:28
  • I had to put it outside the for-loop and then it worked. Thanks man. Howerver how can I sort the issues when printing? Like LB-1 then LB-2 on the next row etc? –  Jun 11 '16 at 08:07