I'm writing an application using PHP and the Jira REST API which is required to generate a report for a particular period of time with the accumulation of hours spent by a person on a particular project.
For this I will need a call which will give something like this.
e.g: For the period 01/01/2012 - 31/01/2012 give me the worklogs for project X.
The method I found so far, was to get the updated issues after the start date and filter the worklogs for each issue by the period again.
Is there a better alternative?
It is worth pointing out that Jira queries have an
expand
option which allows you to specify which fields you want attached to your search:The returned JSON object returned will be a list of tickets, and each ticket will have a collection of work items attached (potentially zero length).
Javascript rather than PHP, but the same idea holds:
posted on GitLab: https://gitlab.com/jefferey-cave/ProductivityBlockers/blob/5c4cb33276e8403443d4d766fc94ab2f92292da6/plugin-data-jira.js
As many have said, there's no direct way. However, if you narrow down the search space efficiently, it's not so bad. The following PHP code runs quite fast on my setup, but of course, your mileage may vary:
The approach I've personally used for the same kind of an application is to get ALL records from JIRA on a weekly basis and then generate reports from the database they're stored in.
This way you will also have the data available if a major JIRA crash occurs. Our company went through such a problem with a OnDemand instance when a RAID Array burned and most of the data was unrecoverable.
If you can't find the an out-of-the-box function that does what you've asked for, I can think of three other solutions other than yours: