Rest Files » History » Version 2

Toshi MARUYAMA, 2017-01-11 17:51
use XML code syntax highlighting

1 1 Go MAEDA
h1. Files
2 1 Go MAEDA
3 1 Go MAEDA
{{>toc}}
4 1 Go MAEDA
5 1 Go MAEDA
h2. /projects/:project_id/files.:format
6 1 Go MAEDA
7 1 Go MAEDA
h3. GET
8 1 Go MAEDA
9 1 Go MAEDA
Returns the files available for the project of given id or identifier (:project_id).
10 1 Go MAEDA
11 1 Go MAEDA
+Examples+:
12 1 Go MAEDA
13 1 Go MAEDA
<pre>
14 1 Go MAEDA
GET /projects/foo/files.xml
15 1 Go MAEDA
GET /projects/1/files.xml
16 1 Go MAEDA
</pre>
17 1 Go MAEDA
18 1 Go MAEDA
+Response+:
19 1 Go MAEDA
20 2 Toshi MARUYAMA
<pre><code class="xml">
21 1 Go MAEDA
<?xml version="1.0" encoding="UTF-8"?>
22 1 Go MAEDA
<files type="array">
23 1 Go MAEDA
  <file>
24 1 Go MAEDA
    <id>12</id>
25 1 Go MAEDA
    <filename>foo-1.0-setup.exe</filename>
26 1 Go MAEDA
    <filesize>74753799</filesize>
27 1 Go MAEDA
    <content_type>application/octet-stream</content_type>
28 1 Go MAEDA
    <description>Foo App for Windows</description>
29 1 Go MAEDA
    <content_url>http://localhost:3000/attachments/download/12/foo-1.0-setup.exe</content_url>
30 1 Go MAEDA
    <author id="1" name="Redmine Admin"/>
31 1 Go MAEDA
    <created_on>2017-01-04T09:12:32Z</created_on>
32 1 Go MAEDA
    <version id="2" name="1.0"/>
33 1 Go MAEDA
    <digest>1276481102f218c981e0324180bafd9f</digest>
34 1 Go MAEDA
    <downloads>12</downloads>
35 1 Go MAEDA
  </file>
36 1 Go MAEDA
  <file>
37 1 Go MAEDA
    <id>11</id>
38 1 Go MAEDA
    <filename>foo-1.0.dmg</filename>
39 1 Go MAEDA
    <filesize>6886287</filesize>
40 1 Go MAEDA
    <content_type>application/x-octet-stream</content_type>
41 1 Go MAEDA
    <description>Foo App for macOS</description>
42 1 Go MAEDA
    <content_url>http://localhost:3000/attachments/download/11/foo-1.0.dmg</content_url>
43 1 Go MAEDA
    <author id="1" name="Redmine Admin"/>
44 1 Go MAEDA
    <created_on>2017-01-04T09:12:07Z</created_on>
45 1 Go MAEDA
    <version id="2" name="1.0"/>
46 1 Go MAEDA
    <digest>14758f1afd44c09b7992073ccf00b43d</digest>
47 1 Go MAEDA
    <downloads>5</downloads>
48 1 Go MAEDA
  </file>
49 1 Go MAEDA
</files>
50 2 Toshi MARUYAMA
</code></pre>
51 1 Go MAEDA
52 1 Go MAEDA
h3. POST
53 1 Go MAEDA
54 1 Go MAEDA
Upload a file for the project of given id or identifier (:project_id).
55 1 Go MAEDA
56 1 Go MAEDA
+Parameters+:
57 1 Go MAEDA
58 1 Go MAEDA
* @file@ (required): a hash of the version attributes, including:
59 1 Go MAEDA
60 1 Go MAEDA
  * @token@ (required): a token for your uploaded file. See [[Rest_api#Attaching-files|Attaching files]].
61 1 Go MAEDA
  * @version_id@
62 1 Go MAEDA
  * @filename@
63 1 Go MAEDA
  * @description@
64 1 Go MAEDA
65 1 Go MAEDA
+Examples+:
66 1 Go MAEDA
67 1 Go MAEDA
<pre>
68 1 Go MAEDA
POST /projects/1/files.xml
69 1 Go MAEDA
<?xml version="1.0"?>
70 1 Go MAEDA
<file>
71 1 Go MAEDA
  <token>21.01a1d7b1c2ffcbbc9ecf14debeec27d8</token>
72 1 Go MAEDA
  <version_id>2</version_id>
73 1 Go MAEDA
  <filename>foo-1.0-src.tar.tgz</filename>
74 1 Go MAEDA
  <description>Foo App source code</description>
75 1 Go MAEDA
</file>
76 1 Go MAEDA
</pre>