com.atlassian.jira.rest.v2.issue
Class IssueAttachmentsResource

java.lang.Object
  extended by com.atlassian.jira.rest.v2.issue.IssueAttachmentsResource

public class IssueAttachmentsResource
extends Object

Issue attachments

Since:
4.3

Nested Class Summary
static class IssueAttachmentsResource.JiraAttachmentMultipartConfig
           
 
Constructor Summary
IssueAttachmentsResource(JiraAuthenticationContext authContext, IssueManager issueManager, AttachmentService attachmentService, AttachmentManager attachmentManager, IssueUpdater issueUpdater, I18nHelper i18n, IssueFinder issueFinder, JiraBaseUrls jiraBaseUrls, ThumbnailManager thumbnailManager)
           
 
Method Summary
 javax.ws.rs.core.Response addAttachment(String issueIdOrKey, Collection<com.atlassian.plugins.rest.common.multipart.FilePart> fileParts)
          Add one or more attachments to an issue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IssueAttachmentsResource

public IssueAttachmentsResource(JiraAuthenticationContext authContext,
                                IssueManager issueManager,
                                AttachmentService attachmentService,
                                AttachmentManager attachmentManager,
                                IssueUpdater issueUpdater,
                                I18nHelper i18n,
                                IssueFinder issueFinder,
                                JiraBaseUrls jiraBaseUrls,
                                ThumbnailManager thumbnailManager)
Method Detail

addAttachment

public javax.ws.rs.core.Response addAttachment(String issueIdOrKey,
                                               Collection<com.atlassian.plugins.rest.common.multipart.FilePart> fileParts)
Add one or more attachments to an issue.

This resource expects a multipart post. The media-type multipart/form-data is defined in RFC 1867. Most client libraries have classes that make dealing with multipart posts simple. For instance, in Java the Apache HTTP Components library provides a MultiPartEntity that makes it simple to submit a multipart POST.

In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: nocheck with the request, otherwise it will be blocked.

The name of the multipart/form-data parameter that contains attachments must be "file"

A simple example to upload a file called "myfile.txt" to issue REST-123:

curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.txt" http://myhost/rest/api/2/issue/TEST-123/attachments

Parameters:
issueIdOrKey - the issue that you want to add the attachments to
Returns:
a JSON representation of the attachments added.


Copyright © 2002-2013 Atlassian. All Rights Reserved.