How do I count entries within a date range VIA the API please?
Hi
I am trying to get the totoal number of bugs opened within a date range as well as closed in the same data range. This will be repeated every 2 weeks. I have reviewed the API docs and I am happy with the count option however I have been unable to figure out the correct way to represent a date range:
For starters I wish to get all bugs pre 1st Feb 2012, to do this in the front end I woud use 'created: 2011-01 .. 2012-02-01'.
This provides following URL: http://freeagent.myjetbrains.com/youtrack/issues?q=created%3A+2011-01+..+2012-02-01
This seems reasonable so I have attempted it via the api: http://freeagent.myjetbrains.com/youtrack/rest/issue/count?filter=created%3A+2011-01+..+2012-02-01
However this has not worked.
I have tried different ordering and encodings bug to no aval.
Is this possible with YouTrack or am I simply using the wrong syntax?
Thanks
Anthony
Please sign in to leave a comment.
Dear Anthony,
Count method of REST API returns either number of issues matching the request or -1 if count is not calculated yet. So to get real number of issues you have to call to the count method until it returns something different from -1. This is implemented this way for performance reason: calculation of query size can be time cosuming and YouTrack doesn't want to keep http connection while size is calculated.
Hi Max
I understand the -1 response and have catered for this in my script, I am referring to the query as I am submitting it. Syntactically is it a valid query which the API should respond to?
count?filter=created%3A+2011-01+..+2012-02-01
Or should it use Epoch timestamp?
count?filter=created%3A1293840000+..+1328140799
Thanks