Project

General

Profile

Actions

Feature #13275

open

Add query parameters/filter for listing time entries via REST API

Added by Chad B about 11 years ago. Updated almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

Currently it appears that the only way to retrieve time entries with the REST API is to either list all time entries or request them one at a time by ID. At least, that is all that is documented (http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries).

This is of very limited usefulness given that an instance may easily contain thousands upon thousands of time entries. It would be very helpful to be able to query by certain conditions or in other words filter.

Primary candidates for filter conditions would be:
  • Updated date
  • Created date
  • ID number
  • User
  • Project
  • Issue
  • Activity
  • Combinations of the above

Conditions would need to support ranges.

Hypothetical examples:

  • GET /time_entries.xml?user=X
  • GET /time_entries.xml?issue=X
  • GET /time_entries.xml?updated_on=>=2013-02-24
  • GET /time_entries.xml?id=><100|200

Priority wise I believe the queries by ID and updated date are the most important because those would at least make it possible to check for recent updates or new entries after some starting point, which is crucial functionality for many integrations.

Also refer to http://www.redmine.org/boards/1/topics/29631


Files


Related issues

Has duplicate Redmine - Feature #12763: Add filtering capability to time entries REST APIClosed

Actions
Actions #1

Updated by Knut Meyer about 11 years ago

Hi,

here I would like to name one other filter condition

  • spent on

Thanks!
Knut

Actions #2

Updated by Bob Pack almost 11 years ago

+1. This makes the "time entries" part of the API very useful. Without it, it's needlessly intensive to do simple things. I think the most key filter would be Knut's "spent on" filter suggestion.

Actions #3

Updated by Bob Pack almost 11 years ago

Should have known it already exists! Great.
This works just fine on my server (2.2.2)
http://&lt;redmine URL>/time_entries.xml?spent_on=%3E%3C2013-05-01|2013-05-31

Also tried it with issue_id and project_id, which worked fine as well.

Actions #4

Updated by shawn gao almost 11 years ago

hi man, the url can't work on my server. They just ingore the parameter like "spent_on=%3E%3C2013-05-01|2013-05-31"
can you tell me why would that happen
thanks!

Actions #5

Updated by Juozapis Juozapauskiksi over 10 years ago

Bump
Is there any news regarding this one?
Spent on is working, but updated_on created_on is not :(

Actions #6

Updated by Juozapis Juozapauskiksi over 10 years ago

Bump. Any news on this one?
Sorry, but I think this is critical one for Redmine integration.

Actions #7

Updated by Toshi MARUYAMA over 10 years ago

  • Has duplicate Feature #12763: Add filtering capability to time entries REST API added
Actions #8

Updated by Juozapis Juozapauskiksi over 10 years ago

Bump. Any news on this one here?

Actions #9

Updated by Juozapis Juozapauskiksi over 10 years ago

Any news regarding this one?

Actions #10

Updated by Juozapis Juozapauskiksi over 10 years ago

Bump. Any news?

Actions #11

Updated by Juozapis Juozapauskiksi over 10 years ago

Bump.

Actions #12

Updated by Bob Pack over 9 years ago

shawn gao wrote:

hi man, the url can't work on my server. They just ingore the parameter like "spent_on=%3E%3C2013-05-01|2013-05-31"
can you tell me why would that happen
thanks!

Sorry, didn't see this till now. If you're using the exact same query I used before, it could be a permissions issue perhaps? Make sure the API token you are using has appropriate rights? I can't think of any other reason the same query that works on mine wouldn't work on yours, unless it's a version difference (as I mentioned, I am on a 2.2.2 build)

Actions #13

Updated by V Lindell over 8 years ago

As previously mentioned this can already be done "/time_entries.xml?spent_on=><2015-06-01|2015-06-30".

API Documentation should be updated by the filtering posibilities already available.

Actions #14

Updated by Tommaso Visconti over 8 years ago

It's also possible to filter by user id:

/time_entries.json?user_id=<ID>
/time_entries.json?user_id=me

This is totally undocumented!!!

Actions #15

Updated by Eugene Terekhov over 8 years ago

Filtering by created/updated date would be very appreciated.

That spent_on filter just isn't enough.

Actions #16

Updated by Dain Gosbee over 8 years ago

I agree with Eugene that the spent_on filter is too limiting. I also would heavily appreciate being able to filter by created_on/updated_on.

+1 to Eugene´s post.

Actions #17

Updated by Thibaut Tropardy about 8 years ago

For ticket filter

/time_entries.json?issue_id=<ID>

Actions #18

Updated by Valentin Rudikov almost 8 years ago

Hello! Also it would be good to support filtering by multiple users:
/time_entries.json?user_id=[123,456]
It will reduce requests count - no need to query server multiple times(for each user)

Actions #19

Updated by Anonymous over 7 years ago

Hello, I've run into this issue as well and wrote a small patch to expose the created_on field to the REST API. I'd welcome any feedback, especially on further steps to include it into Redmine proper.

Actions #20

Updated by Pablo Díaz almost 6 years ago

Somebody know howto filter by time interval?.

If i use the URL (replacing redmineUrl by a real url and keyValue with a valid key value): https://redmineUrl/time_entries.json?key=keyValue&spent_on=2018-03-01 it returns a valid time entries for this day but if I use the interval filter as said in manualPage: http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#spent_on-filter such us: !https://redmineUrl/time_entries.json?key=keyValue&spent_on=><2018-04-01|2018-04-30 It returns the same values as doesn't write any spent_on date filter.

Anyone knows how to use spent_on date filters? May be a bug?

My redmine version is 3.3

Actions #21

Updated by Pablo Díaz almost 6 years ago

I've found a solution for comment 20.

If I put at the end of URL &limit=5000 I get the time_entries for the given interval with a correct result.

That is, for the example wrote on comment 20 the final url would be:

!https://redmineUrl/time_entries.json?key=keyValue&spent_on=><2018-04-01|2018-04-30&limit=5000

Actions

Also available in: Atom PDF