Patch #6277

REST API for Search

Added by Akiko Takano about 5 years ago. Updated about 1 month ago.

Status:NewStart date:2010-09-03
Priority:NormalDue date:
Assignee:-% Done:


Category:REST API
Target version:-


Some CMS or Web Application have REST API or RSS/Atom API for search function.
Since search controller don't have to implement any update/delete/create function, I suppose only an xml template is required to support REST API.

This patch is over r4053.

search_rest_api.patch Magnifier (1.21 KB) Akiko Takano, 2010-09-03 02:27


#1 Updated by Eric Davis about 5 years ago

  • Category set to REST API

I'll need some tests for this patch before it can be reviewed.

#2 Updated by Akiko Takano about 5 years ago

Thanks for your taking time to see it.
I hope to apply this feature to RedmineAir if implemented.

#3 Updated by Christian Baus about 2 years ago

+1 for this feature!!

i adapt the patch above for the current redmine version 2.3 and add some extension

Edit: app/controller/search_controller.rb (render part of index action)

    respond_to do |format|
        format.html { render 'search/index', :layout => !request.xhr? }
        format.api  { }

Add: app/views/search/index.xml.builder

xml.search_results :type => 'array' do
  @results.each do |result|
          xml.result do
                xml.title       result.event_title
                xml.type        result.event_type
                xml.url url_for(result.event_url(:only_path => false))
        xml.description result.event_description
        xml.datetime    result.event_datetime

if result.class == Issue
        xml.tracker_id result.tracker_id
        xml.project_id result.project_id
        xml.subject result.subject
        xml.category_id result.category_id
        xml.assigned_to_id result.assigned_to_id
        xml.priority_id result.priority_id
        xml.author_id result.author_id
        xml.created_at result.created_on
        xml.updated_at result.updated_on
        xml.status result.status
        xml.subject result.subject

if result.class == Project
        xml.parent_id result.parent_id
        xml.created_at result.created_on
        xml.updated_at result.updated_on
        xml.status result.status
        custom_field ={|f|"intranet_description")}.first

        if custom_field && custom_field.custom_values
                xml.intranet_description custom_field.custom_values.first.value
                xml.intranet_description "" 


#4 Updated by Terence Mill about 2 years ago


#5 Updated by David Rahusen almost 2 years ago


#6 Updated by Tony NG 9 months ago


#7 Updated by Matthias Schelling 7 months ago


#8 Updated by Dmitry Azarenko about 1 month ago


Also available in: Atom PDF