https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292016-09-05T14:43:25ZRedmineRedmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=732862016-09-05T14:43:25ZFelix Schäfer
<ul></ul><p>I just realised <a class="changeset" title="Implements /issues/new form for creating issues outside a project (#1003)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/13999">r13999</a> only contains half the information to understand this… In <a class="changeset" title="Implements /issues/new form for creating issues outside a project (#1003)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/13999">r13999</a> the before filter for <code>create</code> was changed from <code>IssuesController#find_project</code> to <code>ApplicationController#find_optional_project</code>. The <code>issuesController</code> method looked for the <code>project_id</code> as <code>project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id])</code>, but <code>find_optional_project</code> (<a class="source" href="https://www.redmine.org/projects/redmine/repository/svn/revisions/13999/entry/trunk/app/controllers/application_controller.rb#L304">source:/trunk/app/controllers/application_controller.rb@13999#L304</a>) only looks for <code>params[:project_id]</code>.</p> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=732872016-09-05T14:58:58ZFelix Schäfer
<ul></ul><p>And as we're still investigating this even more info:</p>
<p>Felix Schäfer wrote:</p>
<blockquote>
<p>it is not possible anymore to pass <code>params[:issue][:project_id]</code> to the new issue API anymore</p>
</blockquote>
<p>It was possible to pass <code>project_id</code> as the identifier string before, this is not possible anymore, this only works with numeric IDs now.</p> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=733172016-09-06T10:05:21ZHolger Just
<ul><li><strong>File</strong> <a href="/attachments/16647">0001-Allow-to-specify-projects_id-as-identifier-in-issue-creation.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/16647/0001-Allow-to-specify-projects_id-as-identifier-in-issue-creation.diff">0001-Allow-to-specify-projects_id-as-identifier-in-issue-creation.diff</a> added</li></ul><p>The attached patch (with a test) fixes this and restores the behavior of the API as it was before <a class="changeset" title="Implements /issues/new form for creating issues outside a project (#1003)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/13999">r13999</a>. With this patch, the API again allows to specify the identifier of the project instead of just the numeric ID in the <code>issue[project_id]</code> params key.</p>
<p>This can be reproduced with this curl:</p>
<pre>
curl -v -XPOST http://admin:admin@localhost:3000/issues.json -d '{"issue":{"subject": "Test", "project_id": "test"}}' -H "Content-Type: application/json"
</pre> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=733352016-09-07T00:02:07ZMischa The Evil
<ul></ul><p>Hello Felix and Holger,</p>
<p>FWIW, you might want to take a look at <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: Creating new issues with invalid project_id should return 422 instead of 403 error (Closed)" href="https://www.redmine.org/issues/19276">#19276</a> (and related <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: REST API: setting project_id in issue not accepted in Redmine 3.0.3 (Closed)" href="https://www.redmine.org/issues/20119">#20119</a>).</p>
<p>Greetings, Mischa.</p> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=733412016-09-07T08:17:59ZFelix Schäfer
<ul></ul><p>Mischa, thanks for the follow-up.</p>
<p>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.</p>
<p>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 <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: REST API: setting project_id in issue not accepted in Redmine 3.0.3 (Closed)" href="https://www.redmine.org/issues/20119">#20119</a> it is still possible to pass an identifier instead of the numeric ID to <code>params[:project_id]</code> but not to <code>params[:issue][:project_id]</code>. This means not supporting identifiers in <code>params[:issue][:project_id]</code> is a breaking regression and introduces an inconsistency between these 2 options.</p>
<p>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 :-)</p> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=733432016-09-07T09:16:07ZJan from Planio www.plan.io
<ul></ul><p>Felix Schäfer wrote:</p>
<blockquote>
<p>This will be our last comment on the matter though and we will not discuss this further either way :-)</p>
</blockquote>
<p>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."</p>
<p>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.</p>
<p>Thanks to everyone involved!</p> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=733632016-09-07T14:56:31ZFelix Schäfer
<ul></ul><p>I indeed didn't mean to be rude, sorry if it came across that way. Thanks Jan for clarifying.</p> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=736712016-09-21T03:37:19ZToshi MARUYAMA
<ul><li><strong>Target version</strong> set to <i>3.3.1</i></li></ul> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=738182016-10-01T09:08:06ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Subject</strong> changed from <i>Regression in issue creation API</i> to <i>API : creating issues with project identifier no longer possible</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>Fix committed in <a class="changeset" title="Let the API accept project identifier for creating issues (#23766). Patch by Holger Just." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/15855">r15855</a>, thanks. I've moved the test to the API tests to make sure we don't remove/break it in the future.</p> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=738362016-10-02T10:21:07ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=738632016-10-02T18:13:24ZFelix Schäfer
<ul></ul><p>Thank you :-)</p> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=746492016-11-23T09:31:30ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/19276">Defect #19276</a>: Creating new issues with invalid project_id should return 422 instead of 403 error</i> added</li></ul> Redmine - Defect #23766: API : creating issues with project identifier no longer possiblehttps://www.redmine.org/issues/23766?journal_id=746512016-11-23T09:32:00ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/20119">Defect #20119</a>: REST API: setting project_id in issue not accepted in Redmine 3.0.3</i> added</li></ul>