如何使用JIRA -REST-API for python访问下一页 [英] How to access the next page using JIRA -REST-API for python
问题描述
我正在尝试获取与项目相关的所有问题.当我执行以下代码时,我只会得到50个结果.我需要浏览所有页面并获取所有错误.请帮助
I am trying to fetch all issues related to a project. When I execute the below code, I get only 50 results. I need to navigate all pages and get all the bugs.Please help
all_issues = jira.search_issues('project=ProjectName')
each_issue = sorted([issue.key for issue in all_issues])
for item in each_issue:
print item
由于该页面的默认值为50,所以只给了我50个问题.我需要获取所有问题.
This gives me only 50 issues since the page has default value of 50. I need to get all the issues.
推荐答案
尝试;
all_issues = jira.search_issues('project=ProjectName', maxResults=50, startAt=50)
分页REST API的结果,默认结果数为50.您可以提供 startAt
值以从结果集中的某个点开始结果.默认情况下,该值为0.
The results from the REST API are paged, with the default number of results being 50. You can supply the startAt
value to start the results from a point in the result set. By default this value is 0.
因此,您的原始查询将获得0-49的结果,上面的查询将获得50-99的结果,将 startAt
更改为100将获得100-149,依此类推.
So, your original query would get results 0-49, the query above would get results 50-99 and changing startAt
to 100 would get 100-149, and so on.
您还可以增加 maxResults
的值,以每页返回更多结果.但是,这仅限于JIRA实例中配置的 jira.search.views.default.max
的最大值(默认设置为1000).
You can also increase the value of maxResults
to return more results per page. However, this is limited to the max value of jira.search.views.default.max
configured in your JIRA instance (set to 1000 by default).
不可能不进行分页就使API返回所有问题.您必须将 jira.search.views.default.max
配置为一个非常大的值,并将该值作为 maxResults
提供.
It is not possible to make the API return all issues without paging. You would have to configure jira.search.views.default.max
to a very large value and supply that value as maxResults
.
这篇关于如何使用JIRA -REST-API for python访问下一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!