プロジェクト

全般

プロフィール

Vote #68009

完了

REST API for Search

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
REST API_32
対象バージョン:
開始日:
2010/09/03
期日:
進捗率:

0%

予定工数:
category_id:
32
version_id:
110
issue_org_id:
6277
author_id:
5674
assigned_to_id:
1
comments:
19
status_id:
5
tracker_id:
3
plus1:
8
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.


journals

I'll need some tests for this patch before it can be reviewed.
--------------------------------------------------------------------------------
Thanks for your taking time to see it.
I hope to apply this feature to RedmineAir if implemented.
--------------------------------------------------------------------------------
+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)
<pre>
respond_to do |format|
format.html { render 'search/index', :layout => !request.xhr? }
format.api { }
end
</pre>

Add: *app/views/search/index.xml.builder*
<pre>
xml.instruct!
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.id result.id
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
end

if result.class == Project
xml.id result.id
xml.parent_id result.parent_id
xml.created_at result.created_on
xml.updated_at result.updated_on
xml.status result.status
xml.name result.name
custom_field = result.available_custom_fields.select{|f|f.name.eql?("intranet_description")}.first

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

end
end
end

</pre>
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
I do appreciate Akiko Takano's work. I would be very happy if I could see the feature in Redmine 3.3.0.

I have updated the patch:

* Compatible with latest trunk (r15148)
* Added event.id to a response
* Added tests
--------------------------------------------------------------------------------
The patch created by Takenori TAKAKI works fine on the trunk (r15160) and passed all tests.
I propose to deliver this feature in Redmine 3.3.0.
--------------------------------------------------------------------------------
Patch committed. I've made a few more changes to support pagination.
Thanks.
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> Patch committed. I've made a few more changes to support pagination.
> Thanks.

Thank you so much for all you did!

--------------------------------------------------------------------------------
Hi, TAKAKI-san,
Thank you for your support and providing patch file. I really appreciate it!

--------------------------------------------------------------------------------


related_issues

duplicates,Closed,8474,[REST] search issues easily

Admin Redmine さんが約4年前に更新

  • カテゴリREST API_32 にセット
  • 対象バージョン3.3.0_110 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0