It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Retrieve“Time Spent” value under Work Log in JIRA

I would like to write a JQL to retrieve the time spent on a specific sub-task. Below is my query. Sadly, what is being returned is the aggregate value of time spent and not the individual value as shown in the picture below.

This is my query below. Unfortunately, the result is showing an aggregated value. For e.g., it is displaying 6 hours instead of 3 hours (see "Results" picture below).

JIRA.jpg

 

 

Results

Results.png

2 answers

JQL retrieves issues, and the field Time Spent for an issue is the total time spent.

On the DB you there is a worklog table, and via API you can also access every log

https://{your_url}/rest/api/latest/issue/{your_issuekey}/worklog 

If you have scriptrunner instaled, you also can access the issues that were  logged by a certain user or in a certain date. (https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_worklogs)

issueFunction in workLogged(on "2015/07/28" by admin)

 But you get the issue, with its Time Spent showing the total

Hi Fran, Thanks for responding. Can you elaborate on how to use the REST API

 

https://{your_url}/rest/api/latest/issue/{your_issuekey}/worklog 

 

What is "your_url" here and how do I use it? Is ScriptRunner free to use? I am afraid that my company won't pay to buy add-ins.

your url is your jira url (something like 'xxxx.jira.com') you only have to make a GET request to that url and you'll receive a JSON with worklog data, the structure is like this

{
    "startAt": 0,
    "maxResults": 1,
    "total": 1,
    "worklogs": [
        {
            "self": "http://www.example.com/jira/rest/api/2/issue/10010/worklog/10000",
            "author": {
                "self": "http://www.example.com/jira/rest/api/2/user?username=fred",
                "name": "fred",
                "displayName": "Fred F. User",
                "active": false
            },
            "updateAuthor": {
                "self": "http://www.example.com/jira/rest/api/2/user?username=fred",
                "name": "fred",
                "displayName": "Fred F. User",
                "active": false
            },
            "comment": "I did some work here.",
            "visibility": {
                "type": "group",
                "value": "jira-developers"
            },
            "started": "2013-08-23T16:57:35.985+0200",
            "timeSpent": "3h 20m",
            "timeSpentSeconds": 12000,
            "id": "100028"
        }
    ]
}


You have more info here: https://docs.atlassian.com/DAC/rest/jira/6.1.html#d2e1552

Hope this helps you

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

302 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you