Defect #23766
closedAPI : creating issues with project identifier no longer possible
0%
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
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]
.
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.
Updated by Holger Just about 8 years ago
- File 0001-Allow-to-specify-projects_id-as-identifier-in-issue-creation.diff 0001-Allow-to-specify-projects_id-as-identifier-in-issue-creation.diff added
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"
Updated by Mischa The Evil about 8 years ago
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 :-)
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!
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.
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.
Updated by Jean-Philippe Lang about 8 years ago
- Status changed from Resolved to Closed
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
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