Project

General

Profile

Rest Attachments » History » Revision 2

Revision 1 (Jean-Philippe Lang, 2011-07-18 23:02) → Revision 2/5 (Jean-Philippe Lang, 2012-04-11 19:30)

h1. Attachments 

 To attach files though the API, please see [[Rest_api#Attaching-files|Attaching files]] in general topics. 

 h2. /attachments/:id.:format 

 h3. GET 

 Returns the description of the attachment of given id.  
 The file can actually be downloaded at the URL given by the @content_url@ attribute in the response. 

 +Example+: 

 <pre> 
 GET /attachments/13.xml 
 </pre> 

 +Response+: 

 <pre> 
 <attachment> 
   <id>6243</id> 
   <filename>test.txt</filename> 
   <filesize>124</filesize> 
   <content_type>text/plain</content_type> 
   <description>This is an attachment</description> 
   <content_url>http://localhost:3000/attachments/download/6243/test.txt</content_url> 
   <author name="Jean-Philippe Lang" id="1"/> 
   <created_on>2011-07-18T22:58:40+02:00</created_on> 
 </attachment> 
 </pre> 


 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@.