Project

General

Profile

Actions

Feature #24976

closed

Include new statuses allowed by workflow in Issues REST API

Added by Stephan Möllgaard about 7 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
REST API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

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!


Files

status-list.png (147 KB) status-list.png Yuichi HARADA, 2021-04-05 09:38
24976.patch (2.58 KB) 24976.patch Yuichi HARADA, 2021-04-05 09:40

Related issues

Has duplicate Redmine - Feature #35032: Get allowed Issue statuses by Issues APIClosed

Actions
Has duplicate Redmine - Feature #10636: get status list for user and current statusClosed

Actions
Has duplicate Redmine - Defect #33965: REST API: Method Not Available see used Status list as per the trackerClosed

Actions
Actions #2

Updated by Bernhard Rohloff about 3 years ago

  • Has duplicate Feature #35032: Get allowed Issue statuses by Issues API added
Actions #3

Updated by Yuichi HARADA about 3 years ago

I would like to add value allowed_statuses to the include parameter.

GET /issues/[id].[format]?include=allowed_statuses

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.

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
Actions #4

Updated by Go MAEDA about 3 years ago

  • Target version set to Candidate for next major release

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.

Actions #5

Updated by Go MAEDA about 3 years ago

  • Subject changed from Redmine API: Support for Workflow to Include new statuses allowed by workflow in Issues REST API
  • Target version changed from Candidate for next major release to 5.0.0

Setting the target version to 5.0.0.

Actions #6

Updated by Go MAEDA almost 3 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you for your contribution.

Actions #7

Updated by Go MAEDA almost 3 years ago

  • Has duplicate Feature #10636: get status list for user and current status added
Actions #8

Updated by Go MAEDA over 2 years ago

  • Has duplicate Defect #33965: REST API: Method Not Available see used Status list as per the tracker added
Actions

Also available in: Atom PDF