Project

General

Profile

Actions

Defect #23766

closed

API : creating issues with project identifier no longer possible

Added by Felix Schäfer about 8 years ago. Updated about 8 years ago.

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

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Since r13999 it is not possible anymore to pass params[:issue][:project_id] to the new issue API anymore. This is still referenced in the API documentation Rest_Issues.


Files


Related issues

Related to Redmine - Defect #19276: Creating new issues with invalid project_id should return 422 instead of 403 errorClosedJean-Philippe Lang

Actions
Related to Redmine - Defect #20119: REST API: setting project_id in issue not accepted in Redmine 3.0.3Closed

Actions
Actions #1

Updated by Felix Schäfer about 8 years ago

I just realised r13999 only contains half the information to understand this… In r13999 the before filter for create was changed from IssuesController#find_project to ApplicationController#find_optional_project. The issuesController method looked for the project_id as project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id]), but find_optional_project (source:/trunk/app/controllers/application_controller.rb@13999#L304) only looks for params[:project_id].

Actions #2

Updated by Felix Schäfer about 8 years ago

And as we're still investigating this even more info:

Felix Schäfer wrote:

it is not possible anymore to pass params[:issue][:project_id] to the new issue API anymore

It was possible to pass project_id as the identifier string before, this is not possible anymore, this only works with numeric IDs now.

Actions #3

Updated by Holger Just about 8 years ago

The attached patch (with a test) fixes this and restores the behavior of the API as it was before r13999. With this patch, the API again allows to specify the identifier of the project instead of just the numeric ID in the issue[project_id] params key.

This can be reproduced with this curl:

curl -v -XPOST http://admin:admin@localhost:3000/issues.json -d '{"issue":{"subject": "Test", "project_id": "test"}}' -H "Content-Type: application/json" 
Actions #4

Updated by Mischa The Evil about 8 years ago

Hello Felix and Holger,

FWIW, you might want to take a look at #19276 (and related #20119).

Greetings, Mischa.

Actions #5

Updated by Felix Schäfer about 8 years ago

Mischa, thanks for the follow-up.

As stated above, albeit not intended this is a regression in the REST API and in our eyes an (unannounced) breaking change. If the rationale to not restore this behaviour breakage is not wanting to write code for it, Holger provided a patch.

If the reason is because it wasn't intended it is not an acceptable changed, such a public API needs to be kept stable. Furthermore, the current behaviour is not consistent. As already noted in #20119 it is still possible to pass an identifier instead of the numeric ID to params[:project_id] but not to params[:issue][:project_id]. This means not supporting identifiers in params[:issue][:project_id] is a breaking regression and introduces an inconsistency between these 2 options.

We realise most of these arguments have already been discussed but we feel strongly about not breaking public APIs, even if the previous behaviour was not intended. This will be our last comment on the matter though and we will not discuss this further either way :-)

Actions #6

Updated by Jan from Planio www.plan.io about 8 years ago

Felix Schäfer wrote:

This will be our last comment on the matter though and we will not discuss this further either way :-)

What Felix wanted to say was along the lines of "We won't be nagging about this anymore should the consensus be that the patch is not needed :) We just wanted to add our view on the matter."

We've implemented Holger's Patch at Planio anyways where we believe that consistency for existing users trumps correctness, but we're obviously perfectly fine should the patch not be integrated into Redmine.

Thanks to everyone involved!

Actions #7

Updated by Felix Schäfer about 8 years ago

I indeed didn't mean to be rude, sorry if it came across that way. Thanks Jan for clarifying.

Actions #8

Updated by Toshi MARUYAMA about 8 years ago

  • Target version set to 3.3.1
Actions #9

Updated by Jean-Philippe Lang about 8 years ago

  • Subject changed from Regression in issue creation API to API : creating issues with project identifier no longer possible
  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Fix committed in r15855, thanks. I've moved the test to the API tests to make sure we don't remove/break it in the future.

Actions #10

Updated by Jean-Philippe Lang about 8 years ago

  • Status changed from Resolved to Closed
Actions #11

Updated by Felix Schäfer about 8 years ago

Thank you :-)

Actions #12

Updated by Go MAEDA about 8 years ago

  • Related to Defect #19276: Creating new issues with invalid project_id should return 422 instead of 403 error added
Actions #13

Updated by Go MAEDA about 8 years ago

  • Related to Defect #20119: REST API: setting project_id in issue not accepted in Redmine 3.0.3 added
Actions

Also available in: Atom PDF