atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.29k stars 642 forks source link

[Jira] epic_issues how to get all issues back? #1286

Open nafanz opened 6 months ago

nafanz commented 6 months ago

jira.epic_issues(epic_key)

Tell me please. Returns only 50 issues, how can I get all issues of a given epic?

gonchik commented 6 months ago

Hi @nafanz ,

As I see we have to add 2 params: maxResults and startAt. https://docs.atlassian.com/jira-software/REST/7.1.7/#agile/1.0/epic-getIssuesForEpic

Than you can crawl and receieve a data Cheers, GT

gkowalc commented 6 months ago

@nafanz you need to use pagination: https://community.atlassian.com/t5/Jira-Service-Management/JIRA-API-code-to-resolve-pagination-for-issue-search/qaq-p/2282054 by utilizing aforementioned parameters maxResults and startAt.

nafanz commented 5 months ago

@gkowalc @gonchik Sorry, but I don't understand. The examples you provided refer to the official Jira API, but I use the epic_issues function from the atlassian-python-api library. As far as I can see from the documentation for this function, pagination is not mentioned here.

Given an epic return all child issues
By default, all fields are returned in this get-issue resource
Cloud Software API

:param epic: str
:param fields: list of fields, for example: ['priority', 'summary', 'customfield_10007']
:param expand: str: A comma-separated list of the parameters to expand.
:returns: Issues within the epic
:rtype: list

That is, I don’t understand how you can pass startAt and maxResults to it. Please provide an example code.

So far I have found a workaround (where there is pagination), but it does not suit me. Since not all of our projects have board_id

jira.get_issues_for_epic(board_id=1, epic_id=1, start=1, limit=1)

:param start: The starting index of the returned issues.
                      Base index: 0.
                      See the 'Pagination' section at the top of this page for more details.
:param limit: The maximum number of issues to return per page.
                      Default: 50.
                      See the 'Pagination' section at the top of this page for more details.
                      Note, the total number of issues returned is limited
                      by the property 'jira.search.views.default.max' in your JIRA instance.
                      If you exceed this limit, your results will be truncated.