Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,328,541
Community Members
 
Community Events
168
Community Groups

Using Search API how to get all WorkLogs

I am using Python and Jira REST APIs to get all the issues logged against a project and the worklogs corresponding to the issue

/rest/api/3/search
payload_dict['expand'] = []
payload_dict['jql'] = "project = TEST AND updated > '2020-01-01 00:00'"

field_list = [
"issuekey",
"issuetype",
"issuelinks",
"worklog"
]
payload_dict['maxResults'] = 100

When the worklog object is returned, i am getting below json object inside issues.fields.worklog. Since i am not getting the next Url for this nested worklog object, i am not sure how do i get remaining objects of the worklog, if it has more than 20.

Any suggestions will be helpful.

{
"startAt": 0,
"maxResults": 20,
"total": 200,
"worklogs": [
{

.

.

}

]

1 answer

1 accepted

1 vote
Answer accepted
Hana Kučerová Community Leader Aug 14, 2021

Hi @Vishal Biyani ,

I would recommend you to use issue search endpoint for getting only list of issues and then Get issue worklog endpoint for getting worklogs for each found issue. There are query parameters like startAt, maxResults etc. available.

@Hana Kučerová Thanks Hana. This is exactly what i ended up doing this. So if issue search returns, total records in worklog as say 38, i am firing the Get issue worklog to startAt 21 and get the remaining work log items

Like Hana Kučerová likes this

Hi @Vishal Biyani Did You figured out that issue.

If u Figured out issue please let me know. 

Thanks in advance

@Hemanth Lucky 

Below is the high level approach i used,

1. I used below end point to get 100 results at a time and looped through the result set.

/rest/api/3/search

 

2. Check  

if issue['fields']['worklog']['total'] > 20:
  Then use /rest/api/3/issue/{ret_issue['key']}/worklog end point to get worklogs starting from 21st record

Note: As per Step 1, issuekey value is available in the json response ({ret_issue['key']})

Hope this helps

@Hemanth Lucky 

Looking forward to discus your doubts with you.

Let me know your email id, and i will message you.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

2,785 views 7 23
Read article

Atlassian Community Events