Copy

Query Issues Using the URL

Last week I showed how to use Redmine's issue filters to create and save a query. This is the recommended way to compose queries but there is another way for power users, the url.
 
Redmine's issue list looks for specific values in the url to manage the filtering, sorting, and other parts of the list. This makes it easy to create ad-hoc queries programatically.
 
NOTE: all of the urls should be url-encoded: http://en.wikipedia.org/wiki/Percent-encoding

Required: Enable the url filtering

The first thing you need to do is to add `set_filter=1`. This tells Redmine to run the filters from the url. If you don't set this, Redmine will use your last query that is stored in your session.
 
/issues?set_filter=1

Sorting

Sorting is done using the `sort` key which takes a comma separated list of fields and a direction. So to sort by the assigned user and then subject you would add:
 
/issues?set_filter=1&sort=assigned_to,subject:asc
 
A list of all of the sortable columns are below.

Grouping

Grouping the issues uses the `group_by` key and the name of the field, like priority.
 
/issues?set_filter=1&group_by=priority
 
A list of all of the columns for grouping are below.

Results per page

The number of results per page is controlled by the `per_page` option. You have to use a value that has been configured in the Administration panel (Admin > Settings > General > "Objects per page options").
 
/issues?set_filter=1&per_page=100

Columns

Controlling the columns is done using the `c[]` key (shorthand for "column names"). There can be multiple values used. So if you only want to show the id, status, and subject columns you would use this:
 
/issues?set_filter=1&c[]=status&c[]=subject
 
(The id and bulk editing columns are always shown)

Filters

Filtering is where things get complex. Redmine requires 3 components for a filter:
 
  • field name - `fields[]` or `f[]` key
  • field operator - `operators[]` or `op[]` key
  • field value - `values[]` or `v[]` key
So to show issues with the status id equal 2 you would need to set:
  • field name - status_id (note that this uses status_id instead of just status)
  • field operator - '=' for equal
  • field value - 2
Which would become:

/issues?set_filter=1&f[]=status_id&v[status_id][]=2&op[status_id]==
 
 
This should give you enough information to start crafting custom queries for your issues list. Some ideas for this are create urls and embed them into reports or even to bookmark.

Sortable columns

You can sort by these column names.
  • project
  • tracker
  • parent
  • status
  • priority
  • subject
  • assigned_to
  • updated_on
  • category
  • fixed_version
  • start_date
  • due_date
  • estimated_hours
  • done_ratio
  • created_on

Groupable columns

These columns can be used in the group_by option
  • project
  • tracker
  • status
  • priority
  • assigned_to
  • category
  • fixed_version
  • done_ratio

Operator Reference

  • = - equal
  • ! - not equal
  • * - all
  • !* - none
  • >= - greater than or equal
  • <= - less than or equal
  • ~ - contains
  • !~ - does not contain
  • t - today
  • w - this week
  • t+ - in (used with dates, e.g. in exactly 5 days)
  • t- - ago
  • <t+ - in less than (used with dates, e.g. in less than 5 days)
  • >t+ - in more than (used with dates, e.g. in more than 5 days)
  • <t- - in less than ago (used with dates, e.g. in less than 5 days ago)
  • >t- - in more than ago (used with dates, e.g. in more than 5 days ago)
  • o - open (only used on status)
  • c - closed (only used on status)

Do you feel like you waste a lot of time in Redmine? Time that could have been used to do something more productive and fun?
 
I did.
 
Then I discovered that there are many changes I could make to Redmine
that would save me hours of work. I've packaged up those tips and
techniques into Redmine Tips: The Book.