diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-11 10:19:11 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-11 10:19:11 +0000 |
commit | 5f57bceabbdccb9e13dd2f0a0a52a0e7fa704c6e (patch) | |
tree | 517aec2c2ce48a0b76317f1a58f0a524c7c0bfd0 /app/views | |
parent | 10ba08ce13f2cfd088fb8eba0d8dd1be6145acc1 (diff) | |
download | redmine-5f57bceabbdccb9e13dd2f0a0a52a0e7fa704c6e.tar.gz redmine-5f57bceabbdccb9e13dd2f0a0a52a0e7fa704c6e.zip |
Makes some attributes optional in API response to get faster/lightweight responses.
These attributes are not required for common uses case (eg. updating an object). They can be requested in the reponse using the 'include' parameter. Example GET /issues/1.xml?include=journals. The list of attributes that can be included in responses will be documented in the wiki.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4486 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/issues/show.api.rsb | 8 | ||||
-rw-r--r-- | app/views/projects/show.api.rsb | 2 | ||||
-rw-r--r-- | app/views/users/show.api.rsb | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/app/views/issues/show.api.rsb b/app/views/issues/show.api.rsb index 9f0d59e8d..a724df10d 100644 --- a/app/views/issues/show.api.rsb +++ b/app/views/issues/show.api.rsb @@ -25,13 +25,13 @@ api.issue do api.created_on @issue.created_on api.updated_on @issue.updated_on - render_api_issue_children(@issue, api) + render_api_issue_children(@issue, api) if include_in_api_response?('children') api.array :relations do @issue.relations.select {|r| r.other_issue(@issue).visible? }.each do |relation| api.relation(:id => relation.id, :issue_id => relation.other_issue(@issue).id, :relation_type => relation.relation_type_for(@issue), :delay => relation.delay) end - end + end if include_in_api_response?('relations') api.array :changesets do @issue.changesets.each do |changeset| @@ -41,7 +41,7 @@ api.issue do api.committed_on changeset.committed_on end end - end if User.current.allowed_to?(:view_changesets, @project) && @issue.changesets.any? + end if include_in_api_response?('changesets') && User.current.allowed_to?(:view_changesets, @project) api.array :journals do @issue.journals.each do |journal| @@ -58,5 +58,5 @@ api.issue do end end end - end unless @issue.journals.empty? + end if include_in_api_response?('journals') end diff --git a/app/views/projects/show.api.rsb b/app/views/projects/show.api.rsb index dc0263712..e08f77b66 100644 --- a/app/views/projects/show.api.rsb +++ b/app/views/projects/show.api.rsb @@ -14,5 +14,5 @@ api.project do @project.trackers.each do |tracker| api.tracker(:id => tracker.id, :name => tracker.name) end - end + end if include_in_api_response?('trackers') end diff --git a/app/views/users/show.api.rsb b/app/views/users/show.api.rsb index c177d49e9..a2e31acc1 100644 --- a/app/views/users/show.api.rsb +++ b/app/views/users/show.api.rsb @@ -20,5 +20,5 @@ api.user do end end if membership.project end - end if @memberships.present? + end if include_in_api_response?('memberships') && @memberships end |