Hi there,
Please tell me how to get more than 20 results using Jira server api.
In the code below, maxResults is specified as 1000, but the result is 20.
There are actually many more issues.
Specifying maxResults up to 20 works as expected, but if it’s 21 or higher, the result will be 20.
start_date = (datetime.today() - timedelta(days=10)).strftime('%Y-%m-%d')
end_date = (datetime.today() - timedelta(days=1)).strftime('%Y-%m-%d')
SEARCH_ENDPOINT = "https://jira.thingy.com/rest/api/2/search"
PROJECT_KEYS = ["MYPRO", "MYPRO2", "MYPRO3"]
projects_query = " OR ".join([f"project = {key}" for key in PROJECT_KEYS])
jql = f"({projects_query}) AND worklogDate >= {start_date} AND worklogDate <= {end_date}"
params = {
"jql": jql,
"fields": "worklog,key,summary",
"maxResults": 1000
}
response = requests.get(SEARCH_ENDPOINT, headers=headers, params=params)
print(response)
print(f'maxResults: {response.json()["maxResults"]}')
print(f'total: {response.json()["total"]}')
print(f'issues: {len(response.json()["issues"])}')
result:
<Response [200]>
maxResults : 1000
total : 20
issues : 20
Thank you
Yosuke