How to extract JIRA work logs through REST API endpoints

I need help figuring out the right API endpoint for getting work log data from JIRA. I already built a console app that successfully pulls issue data using REST calls, but I’m stuck on the timesheet part.

Here’s what I have working so far:

public class ApiClient
{
    public string FetchIssueData(string projectKey)
    {
        string apiEndpoint = $"rest/api/2/search?jql=project={projectKey}";
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseUrl + apiEndpoint);
        request.Method = "GET";
        
        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        using (StreamReader reader = new StreamReader(response.GetResponseStream()))
        {
            return reader.ReadToEnd();
        }
    }
}

This works great for pulling issues, but I can’t find the correct REST endpoint to get work log entries in JSON format. What’s the proper API path for extracting time tracking data from JIRA projects?

hey claire! for worklogs, try using /rest/api/2/issue/{issueKey}/worklog. if u need logs updated after a specific time, use /rest/api/2/worklog/updated. just tweak your existing method and u should be all set!

Had the same problem building a time tracking integration. Worklog data needs a different approach than regular issue queries. You can’t just modify your existing method - the worklog endpoint works differently. First grab your issues, pull out the issue keys, then hit rest/api/2/issue/{issueKey}/worklog for each one separately. The response gives you author info, time spent, descriptions, and timestamps in a nested ‘worklogs’ array. Watch out for visibility restrictions - some JIRA setups only let users see their own time entries. Test with different accounts or you’ll get burned. Don’t forget pagination either since worklogs pile up on older issues.

The worklog endpoint depends on what you need. For specific issues, just add /worklog to your issue endpoint: rest/api/2/issue/{issueKey}/worklog. But since you want timesheet data from projects, you’ll probably want the bulk method - use rest/api/2/worklog/list with POST and throw the issue IDs in the request body. Watch out for worklog permissions though - they’re tricky. Your API user needs ‘Browse projects’ and ‘Work on issues’ permissions for those projects. I hit auth issues pulling worklogs from restricted projects even when issue data worked perfectly. Worklog API is way more restrictive than regular issue search.