プロジェクト

全般

プロフィール

Vote #78208

完了

Include new statuses allowed by workflow in Issues REST API

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

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

0%

予定工数:
category_id:
32
version_id:
155
issue_org_id:
24976
author_id:
193610
assigned_to_id:
332
comments:
7
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Redmine API provide no possibility to get informations about workflows. This feature is important to get informations about next allowed status for issues.

There a lot of posts from people which need this feature.

Please plan to implement this enhancement for the Redmine API - thank you!


journals

--------------------------------------------------------------------------------
I would like to add value *allowed_statuses* to the include parameter.
<pre>GET /issues/[id].[format]?include=allowed_statuses</pre>

By specifying this, you can get the available statuses(same values with issue edit form) from the issue's current tracker, issue's current status, and member's role.

!{width:400px;border:1px solid grey;}status-list.png!

<pre><code class="diff">
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index c994862e1..887bcd4bb 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -112,6 +112,7 @@ class IssuesController < ApplicationController
render :template => 'issues/show'
end
format.api do
+ @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
@changesets = @issue.changesets.visible.preload(:repository, :user).to_a
@changesets.reverse! if User.current.wants_comments_in_reverse_order?
end
diff --git a/app/views/issues/show.api.rsb b/app/views/issues/show.api.rsb
index f474ed9c6..215184014 100644
--- a/app/views/issues/show.api.rsb
+++ b/app/views/issues/show.api.rsb
@@ -77,4 +77,10 @@ api.issue do
api.user :id => user.id, :name => user.name
end
end if include_in_api_response?('watchers') && User.current.allowed_to?(:view_issue_watchers, @issue.project)
+
+ api.array :allowed_statuses do
+ @allowed_statuses.each do |status|
+ api.status :id => status.id, :name => status.name
+ end
+ end if include_in_api_response?('allowed_statuses')
end
</code></pre>
--------------------------------------------------------------------------------
Currently, you cannot get the list of new statuses via the API, so many Redmine clients get the list by scraping the HTML of the edit issue page.
--------------------------------------------------------------------------------
Setting the target version to 5.0.0.
--------------------------------------------------------------------------------
Committed the patch. Thank you for your contribution.
--------------------------------------------------------------------------------

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

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


related_issues

duplicates,Closed,35032,Get allowed Issue statuses by Issues API
duplicates,Closed,10636,get status list for user and current status
duplicates,Closed,33965,REST API: Method Not Available see used Status list as per the tracker

Admin Redmine さんが3年以上前に更新

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

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

いいね!0
いいね!0