JIRA Cloud Attachments in Base64

Eliot Forrest August 10, 2023

I want to find out if JIRA Cloud allows you to send an attachment that has a base64 attachment via a REST call. We are integrated with our EasyVista tool and sending over attachments with a REST call. With JIRA Software (Prem) we were able to use the Tempest Base64 application. This is no longer available in JIRA Cloud Marketplace.

2 answers

1 accepted

0 votes
Answer accepted
Oscar Lopez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 22, 2023

Hi @Eliot Forrest ,
I have finally achieve 2 ways to resolve this.


The first is via Scriptrunner,

we can get the BinaryArray using the Attachment Content API after it convert it to base64. You can test this on the Script Console:

def issueKey = 'EXAMPLE-1234'

def result = get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
if (result.status == 200){
def bodyfields = result.body.fields
def attachment = bodyfields.attachment[0]
def attachmentid = attachment.id
def attachmentfilename = attachment.filename
def attachmenttype = attachment.mimeType
def result2 = get('/rest/api/3/attachment/content/' + attachmentid)
.header('Content-Type', 'application/json')
.asBinary()

def attachmentcontent = result2.body.bytes.encodeBase64().toString()

 The second way is via Zapier,


You would need to use Automation for Jira and W
ebhooks by Zapier to send and capture attachment related data, such as filename, id, filetype (as you need) and in a second Zapier event you would need to use Code Python by Zapier and use this code:

import requests
import base64
import codecs
id = input_data['idattachment']

url = "https://yourdomain.attlassian.net/rest/api/3/attachment/content/"+id
r=requests.get(url , headers={"Content-Type":"application/json","Authorization":"Basic YOUR_TOKEN","Connection":"keep-alive"}, params={"redirect": "false"})attachment_bytes = r.content
base64input = codecs.encode(attachment_bytes,'base64').decode('utf-8')
attachment_text  = bytes(base64input, 'utf-8').decode('utf-8')
return {'bytes':attachment_text }

in both ways you should be able to use the base64 encripted attachment to send it to another app. 

0 votes
Michal Patoprsty
Contributor
August 11, 2023

Hi @Eliot Forrest 

I am writing on behalf of Base64 Attachment REST API app Vendor.

Our app is available in Atlassian marketplace for Server and Datacenter versions. Unfortunately we do not have Cloud version yet.

However, we are considering implementation of an Cloud version this year. If you would like to keep in touch about progress on this or has another features to enhance app functionality you can raise an feature request in our support portal.

Michal

Eliot Forrest August 11, 2023

Hello @Michal Patoprsty Thanks for the response, I will check-in from time to time on the Cloud version. 

 

With that stated, has any figured out how to solve this with the Cloud Version. 

Like Michal Patoprsty likes this
Michal Patoprsty October 17, 2023

Hi @Eliot Forrest I would like to inform you that we have successfuly released our Cloud version for Base64 Attachment REST API

Kindly note that installation process is slightly different than datacenter version. More information regarding installation can be found in our documentation

In case you would have any other questions just let me know.

 

Michal

Eliot Forrest November 27, 2023

This is fantastic news and perfect timing. 

Suggest an answer

Log in or Sign up to answer