Dears,
I want to send Jira requests attachment as base64 format to external system I already have scriptrunner is there any hope to be able to send attachment to External API through listener or automation or any other way
Hi @Mohamed Saad Taha
Yes, you can achieve that with a listener.
I hope it helps
// first get the attachment from the event objectdef attachment = event.attachmentdef attachmentFile = attachment.getFile()// then base64 decode the filedef bytes = attachmentFile.bytesdef base64 = Base64.encoder.encodeToString(bytes)// set your body with key, filename and the decoded def body = [ issueKey : attachment.issue.key, filename : attachment.filename, data : base64]def response = post("https://your.external.endpoint/") .header("Content-Type", "application/json") .body(JsonOutput.toJson(body)) .asString()
It looks like you're new here. Sign in or register to get started.