Rest Attachments » History » Version 3

Go MAEDA, 2017-07-12 16:03
PATCH /attachments/:id.:format should be documented.

1 1 Jean-Philippe Lang
h1. Attachments
2 1 Jean-Philippe Lang
3 2 Jean-Philippe Lang
To attach files though the API, please see [[Rest_api#Attaching-files|Attaching files]] in general topics.
4 2 Jean-Philippe Lang
5 1 Jean-Philippe Lang
h2. /attachments/:id.:format
6 1 Jean-Philippe Lang
7 1 Jean-Philippe Lang
h3. GET
8 1 Jean-Philippe Lang
9 1 Jean-Philippe Lang
Returns the description of the attachment of given id. 
10 1 Jean-Philippe Lang
The file can actually be downloaded at the URL given by the @content_url@ attribute in the response.
11 1 Jean-Philippe Lang
12 1 Jean-Philippe Lang
+Example+:
13 1 Jean-Philippe Lang
14 1 Jean-Philippe Lang
<pre>
15 1 Jean-Philippe Lang
GET /attachments/13.xml
16 1 Jean-Philippe Lang
</pre>
17 1 Jean-Philippe Lang
18 1 Jean-Philippe Lang
+Response+:
19 1 Jean-Philippe Lang
20 1 Jean-Philippe Lang
<pre>
21 1 Jean-Philippe Lang
<attachment>
22 1 Jean-Philippe Lang
  <id>6243</id>
23 1 Jean-Philippe Lang
  <filename>test.txt</filename>
24 1 Jean-Philippe Lang
  <filesize>124</filesize>
25 1 Jean-Philippe Lang
  <content_type>text/plain</content_type>
26 1 Jean-Philippe Lang
  <description>This is an attachment</description>
27 1 Jean-Philippe Lang
  <content_url>http://localhost:3000/attachments/download/6243/test.txt</content_url>
28 1 Jean-Philippe Lang
  <author name="Jean-Philippe Lang" id="1"/>
29 1 Jean-Philippe Lang
  <created_on>2011-07-18T22:58:40+02:00</created_on>
30 1 Jean-Philippe Lang
</attachment>
31 1 Jean-Philippe Lang
</pre>
32 1 Jean-Philippe Lang
33 1 Jean-Philippe Lang
34 1 Jean-Philippe Lang
Note: when getting an issue through the API, its attachments can also be retrieved in a single request using @GET /issues/:id.:format?include=attachments@.
35 3 Go MAEDA
36 3 Go MAEDA
37 3 Go MAEDA
h3. PATCH
38 3 Go MAEDA
39 3 Go MAEDA
Updates attachments.
40 3 Go MAEDA
41 3 Go MAEDA
(Not documented yet. See #12181 for details)