How to transfer an attachment to a rest

Hello! 

I want to transfer the attachment to another server using rest, how can I do this.

 

I wanted to pass by Multipart, but I have nothing coming out.

 

 def attachmentManager = ComponentAccessor.getAttachmentManager()
def attachments = attachmentManager.getAttachments(issue).get(0)

def attachmentsType = attachmentManager.getAttachments(issue).get(0).getMimetype()

MultipartEntity multiPartContent = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE)

multiPartContent.addPart("jpeg", new File(attachments, attachmentsType))

 Script function failed on issue: AT-18778, actionId: 71, file: <inline script>
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.io.File(com.atlassian.jira.issue.attachment.Attachment, java.lang.String)
at Script1369.run(Script1369.groovy:190)

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,074 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you