how to get the worklogs on daily basis based on the particular person

Johnkumar March 14, 2024

HI Team, 

 

using rest Api i just want to get the worklogs day basis on particular person . could you please help me how can i frame the api to get the current day worklog for particular person

3 answers

0 votes
Tugba Capaci
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2024

Yes, you are right.

 

The search endpoint returns all worklogs. Initially, we utilized this endpoint to retrieve related issues.

After making this call, iterate through the issues in the response and execute get issue worklogs endpoint to retrieve each issue's worklogs. As parameters, provide the issue key and `startedAfter`(set to today's date). This call will return all worklogs logged today.

As a final step, iterate through these worklogs and filter out those logged by other users.



# Make a GET request to retrieve all worklogs for today associated with a specific user.

GET /rest/api/3/search?jql=worklogDate >= startOfDay() AND worklogDate <= endOfDay() AND worklogAuthor = "Something"

# Iterate through the response to extract related issues.

for each issue in response:
          issueKey = issue.key

# Make a GET request to retrieve worklogs for the current issue logged today.

GET /rest/api/3/issue/{issueKey}/worklog?startedAfter=startOfDay()&author="Something"

# Iterate through the worklogs to filter out worklogs logged by other users.

for each worklog in issueWorklogsResponse:
       if worklog.author == "Something":
           # Process the worklog as needed.
      else:
          # Ignore worklog logged by other users.


Or Alternatively,

You can directly use the search response to filter out the users and the date.



# Make a GET request to retrieve all worklogs for today associated with a specific user.

GET /rest/api/3/search?jql=worklogDate >= startOfDay() AND worklogDate <= endOfDay() AND worklogAuthor = "Something"

# Iterate through the response to extract related issues.

      for each issue in response:

           for each worklog in issue.worklogs:

                  if worklog.author == "Something" and worklog.started >= startOfDay():

                      # Process the worklog as needed.

                  else:

                      # Ignore worklog logged by other users.

 

 

 

0 votes
Johnkumar March 14, 2024

  

HI Tugba,
thanks for the response. 
i got the api response using /rest/api/3/search?jql=worklogDate >= startOfDay()AND worklogDate <= endOfDay() AND worklogAuthor = "Something"

this url but i could not able to find the today efforts. 
i can see overall efforts which user logged in so far.

 

how can i take the todays efforts from the response 

example:
sub task1

user logged his efforts on 12-03-2024 8h
today he logged  his efforts 14-03-2024 6h

if am hit this api today i should get 6h as worklog. could you please help which response tag i have to refer to get todays log

0 votes
Tugba Capaci
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 14, 2024

Hi @Johnkumar 


I'm afraid you cannot directly find the worklogs belonging to a specific user.

However, using the Rest API, you can try the following:

1- Use search endpoint  and write the JQL as follows 


/rest/api/3/search?jql=worklogDate >= startOfDay()AND worklogDate <= endOfDay() AND worklogAuthor = "Something"

This endpoint returns the issues that the user logged work on.


2- Then use get issue worklogs endpoint to retrieve all worklogs for the specific issue. This returns all worklogs.
3- Filter out the worklogs of other users to find the ones that belong to the specific user.


By the way, I've recently developed an app named Jira Worklog Reporter. It computes the total worklogs logged by users weekly and sends a Slack message detailing their logged work and associated issues. 

If you'd like to check it out or see what I've done to address the issue you faced, here is the link to the app: https://actioner.com/app-directory/jira-worklog-reporter-149.

Feel free to give it a try!


Tugba
actioner.com

Johnkumar March 14, 2024

please help for above request mistakenly i did in answer section

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events