Unfuddle STACK API
Introduction
Attachments represent a file that has been uploaded to a Message, Ticket, Comment or Notebook.
Updating, downloading and deleting attachments works as with other resources in the STACK API. However, note that uploading attachments is a two step process. First, you must upload a file to the API, which will return to you a file upload key. This file upload key is then referenced when creating an attachment on a Message or Ticket.
Please note that the file upload key is only valid for a maximum of 30 minutes. If the key is not used to create an attachment within this 30 minute window, the uploaded file is permanently purged from the system.
Attachment Upload
A file must first be uploaded to the STACK API before it can be attached to a Message or Ticket.
- URL:
- /api/v1/projects/{id}/messages/{id}/attachments/upload[POST]
- /api/v1/projects/{id}/messages/{id}/comments/{id}/attachments/upload[POST]
- /api/v1/projects/{id}/tickets/{id}/attachments/upload[POST]
- /api/v1/projects/{id}/tickets/{id}/comments/{id}/attachments/upload[POST]
- /api/v1/projects/{id}/notebooks/{id}/attachments/upload[POST]
- Response Formats:
- XML, JSON
- Response Body:
-
<?xml version="1.0" encoding="UTF-8"?> <upload><key> <!-- i.e. 'a7478121db112c8d50bc6e90dec9b0ff' --> </key></upload>
- Example:
-
curl -i -u username:password -X POST \\ -H 'Accept: application/xml' \\ -H 'Content-Type: application/octet-stream' \\ -T /home/david/product_specification_v1.doc \\ https://mysubdomain.unfuddle.com/api/v1/projects/155/messages/10534/attachments/upload
Attachments
The collection represents all Attachments for the given Message, Ticket or Notebook.
- URL:
- /api/v1/projects/{id}/messages/{id}/attachments[GET, POST]
- /api/v1/projects/{id}/messages/{id}/attachments/{id}[GET, PUT, DELETE]
- /api/v1/projects/{id}/messages/{id}/comments/{id}/attachments[GET, POST]
- /api/v1/projects/{id}/messages/{id}/comments/{id}/attachments/{id}[GET, PUT, DELETE]
- /api/v1/projects/{id}/tickets/{id}/attachments[GET, POST]
- /api/v1/projects/{id}/tickets/{id}/attachments/{id}[GET, PUT, DELETE]
- /api/v1/projects/{id}/tickets/{id}/comments/{id}/attachments[GET, POST]
- /api/v1/projects/{id}/tickets/{id}/comments/{id}/attachments/{id}[GET, PUT, DELETE]
- /api/v1/projects/{id}/notebooks/{id}/attachments[GET, POST]
- /api/v1/projects/{id}/notebooks/{id}/attachments/{id}[GET, PUT, DELETE]
- Response Formats:
- XML, JSON
- Request/Response Body:
- See Attachment Data Model
- Example:
-
curl -i -u username:password -X POST \\ -H 'Accept: application/xml' \\ -H 'Content-Type: application/xml' \\ -d '<attachment><filename>product_specification_v1.doc</filename><content-type>application/octet-stream</content-type><upload><key>0847a19e8147214cf9c0a036c1918988</key></upload></attachment>' \\ https://mysubdomain.unfuddle.com/api/v1/projects/155/messages/10534/attachments.xml
Attachment Download
Downloads the specified attachment.
- URL:
- /api/v1/projects/{id}/messages/{id}/attachments/{id}/download[GET]
- /api/v1/projects/{id}/messages/{id}/comments/{id}/attachments/{id}/download[GET]
- /api/v1/projects/{id}/tickets/{id}/attachments/{id}/download[GET]
- /api/v1/projects/{id}/tickets/{id}/comments/{id}/attachments/{id}/download[GET]
- /api/v1/projects/{id}/notebooks/{id}/attachments/{id}/download[GET]
- Response Formats:
- Content-type is as specified in the Attachment data model.
- Example:
-
curl -i -u username:password -X GET \\ https://mysubdomain.unfuddle.com/api/v1/projects/155/messages/10534/attachments/434/download