https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292015-02-16T19:56:36ZRedmineRedmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=615472015-02-16T19:56:36ZLucile Quirion
<ul><li><strong>Category</strong> set to <i>REST API</i></li></ul> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=615482015-02-16T21:35:24ZLucile Quirion
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/61548/diff?detail_id=46572">diff</a>)</li><li><strong>Status</strong> changed from <i>New</i> to <i>Needs feedback</i></li></ul> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=615902015-02-18T12:06:14ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Assignee</strong> set to <i>Lucile Quirion</i></li></ul><p>That's a good start but here are a few things that need to be changed:</p>
<ul>
<li>I'll prefer to keep only one resource for project files, which would be <code>/projects/:project_id/files</code>, so we should remove the alternate <code>POST /projects/foo/versions/123/files</code> to create a file associated to a version (<code>POST /projects/foo/files</code> with a version_id attribute will be used instead).</li>
</ul>
<ul>
<li><code>POST /projects/:project_id/files</code> should create a single file with the file attributes given in a "file" hash (instead of <code>attachments / file_1</code> ), eg.</li>
</ul>
<pre>
{ "file": {
"filename": "foo",
...
}
</pre>
<ul>
<li><code>GET /projects/:project_id/files</code> should include the names of author and version (if any), just like it's done for the issues, eg.:
<p>api.author(:id => file.author_id, :name => file.author.name)</p></li>
</ul>
<ul>
<li>Maybe should simply use the AttachmentsHelper#render_api_attachment to format most of the file attributes</li>
</ul>
<ul>
<li>We don't keep track of authors in the source code</li>
</ul>
<ul>
<li>I hold the copyright for the Redmine source code, I can't include a source file that is copyrighted to a third-party in the core.</li>
</ul> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=616072015-02-18T17:01:55ZLucile Quirion
<ul></ul><p>Thanks for the feedback, I'll modify my patch.</p>
<p>Concerning the POST request, would the following JSON be acceptable ?<br /><pre>
{ "project": {
"version_id": "123",
"files": [
{ "filename": "file_1",
"description": "",
"content_type": "",
"token": "foo_1"
},
{ "filename": "file_2",
"token": "foo_2"
}
]
}
}
</pre><br />Where version_id, filename, description and content_type are optional parameters.</p>
<p>This way it will be possible to handle several files at once (as done in the IssuesController).</p> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=616252015-02-19T16:15:43ZLucile Quirion
<ul><li><strong>File</strong> <a href="/attachments/13157">0001-REST-API-add-files-REST-API_v2.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/13157/0001-REST-API-add-files-REST-API_v2.patch">0001-REST-API-add-files-REST-API_v2.patch</a> added</li></ul><p>Here is the updated patch.<br />The expected JSON format is<br /><pre>
{ "file": {
"filename",
...
}
}
</pre></p>
<p>I used the AttachmentsHelper#render_api_attachment, which I've modified to accept additional options (in order to diplay the version_id).<br />I can remove this modification if necessary.</p> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=616662015-02-23T14:22:58ZLucile Quirion
<ul><li><strong>Assignee</strong> changed from <i>Lucile Quirion</i> to <i>Jean-Philippe Lang</i></li></ul> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=623582015-03-18T07:57:31ZToshi MARUYAMA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/7725">Feature #7725</a>: REST API for files</i> added</li></ul> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=623602015-03-18T07:57:48ZToshi MARUYAMA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-1 priority-4 priority-default" href="/issues/18245">Feature #18245</a>: Documents REST API</i> added</li></ul> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=623622015-03-18T07:58:03ZToshi MARUYAMA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-1 priority-4 priority-default" href="/issues/13800">Feature #13800</a>: File REST API</i> added</li></ul> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=664382015-10-05T09:11:10ZMarco Descher
<ul></ul><p>Any chance this will be part of an upcoming release? :)</p> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=683302016-01-07T16:06:02ZLarry Owen
<ul></ul><p>What's the status on this feature? Sure would be helpful.</p> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=683642016-01-09T04:01:26ZGo MAEDA
<ul></ul><p>The patch 0001-REST-API-add-files-REST-API_v2.patch cannot be applied to current trunk (<a class="changeset" title="Merged r15006 from trunk to 2.6-stable (#21588) Simplified Chinese "field_cvs_module" translatio..." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/15012">r15012</a>).</p>
<pre>
$ patch -p1 < 0001-REST-API-add-files-REST-API_v2.patch
patching file app/controllers/files_controller.rb
Hunk #3 FAILED at 49.
1 out of 3 hunks FAILED -- saving rejects to file app/controllers/files_controller.rb.rej
patching file app/helpers/attachments_helper.rb
patching file app/views/files/index.api.rsb
patching file test/integration/api_test/api_routing_test.rb
patching file test/integration/api_test/files_test.rb
</pre> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=723722016-07-22T17:08:50ZJake Kemme
<ul><li><strong>File</strong> <a href="/attachments/16402">0001-REST-API-add-files-REST-API_v3.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/16402/0001-REST-API-add-files-REST-API_v3.patch">0001-REST-API-add-files-REST-API_v3.patch</a> added</li></ul><p>Updated Patch from Hg attached. We are currently using on 3.3 with no issues.</p> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=728022016-08-21T04:31:51ZToshi MARUYAMA
<ul><li><strong>Status</strong> changed from <i>Needs feedback</i> to <i>New</i></li><li><strong>Target version</strong> set to <i>3.4.0</i></li></ul> Redmine - Patch #19116: Files REST APIhttps://www.redmine.org/issues/19116?journal_id=751972016-12-21T10:06:24ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li></ul><p>Committed in <a class="changeset" title="Files REST API (#19116). Patch by Lucile Quirion and Jake Kemme." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/16109">r16109</a> with a few changes to the index response. Thanks.</p>