Hello,
i am trying to send attachments from an external ticket-system (BMC ITSM-Suite) to Jira. My request is working. It adds an attachment to an existing issue. But it seems like Jira is not decoding the data which is send in base64.
This is my request:
--W3NByNRZZYy4ALu6xeZzvWXU3NVmYUxoRB
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
[content of test.txt]
--W3NByNRZZYy4ALu6xeZzvWXU3NVmYUxoRB--
The content of my file is:
test
The content of the file in Jira is:
dGVzdA==
The content of the Jira file is the base64-coded content of the origin file.
Has someone had the same issue? Or has someone an idea what the problem could be?
Best Regards!
Dear @TieDall,
you have to envelope your attachment on your own. Jira doesn't process base64 files. So best you decode your attachment and then post them to the API:
See my Java snipplet for this:
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.Header;
HttpPost postRequest = new HttpPost(url);
postRequest.addHeader(header);
MultipartEntityBuilder multipartEntity = MultipartEntityBuilder.create();
multipartEntity.setMode(HttpMultipartMode.STRICT);
multipartEntity.addBinaryBody("file", new File(path));
postRequest.setEntity(multipartEntity.build());
So long
Thomas
Hi @Thomas Deiler,
the external ticket-system can only send the file coded in base64. I have no chance to change that.
Is their no way to decode the file in Jira?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear @TieDall,
I have checked the documentation a second time. Base64 is accepted as a MulitPartEntity mesasge. So I guess, that somehow what you send to Jira does not comply to RFC2388. Best you check how for example curl sends attachments to Jira and then reimplement this in your case.
If this doesn't work, implement a small proxy service (or script), that accepts Base64 attachments, file name and target issue key, to do the job for you.
So long
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, @Thomas Deiler!
I didn´t find any errors in my request. I solved the problem by implementing a small proxy service, as you mentioned earlier.
Best regards!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, i am facing same issue and trying to attach the file , could you please share the proxy service you created
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Muhammad Ramzan_Atlassian Certified Master_ if you have a Jira server you can try to use our free addon from the marketplace which decodes your base64 encoded attachments.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks its amazing i installed and using it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Michal PatoprstyI'm using Jira cloud, and it says cannot be installed on this Cloud instance, Is there any other way?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @蒋志强
Unfortunately, there is no Jira Cloud version of our Addon yet.
Althought we have started talking about implementing a Cloud version.
In the meantime you can create a feature request in our customer portal so we can keep you informed once it's in beta testing.
Michal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It would help us a lot to have the app in Jira cloud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A JIRA Cloud version of Base64 Upload plugin is currently in our pipeline and might be available in Q3 2023 in Atlassian marketplace.
I will post here once it is live.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Israel Adonis Urbina Vargas , @蒋志强
We have successfully released a JIRA Cloud version of Base64 Upload plugin
You can try and install it on your site.
However Cloud version has different installation methods so I would suggest first go through our Cloud documentation
We would be very grateful for every feedback you could provide as well as review of our app in marketplace.
If you would have any problems just let us know.
Michal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi guys,
in case anyone else have this kind of problem. We just recently released on marketplace Base64 Attachment Upload app which is decoding base64 attachments data on Jira Server side.
So if you don't want to implement your own service just install app on Jira and use one of provided endpoints.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Michal Patoprsty , unfortunately its not supporting the service desk customers.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><base64AttachmentUploadResult> <errorMessage>Current user does not have EDIT_ISSUES permission for issue with id ISD-2!</errorMessage> <result>ERROR</result></base64AttachmentUploadResult>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Muhammad Ramzan_Atlassian Certified Master_ , thank you for notifying us about this use case.
We have looked into the lifecycle of attachments that are created using the customer portal (the only place where sd customers can interact with Jira SD). It works a little bit differently than the usual attachment lifecycle. Any attachment that is submitted by customer user is always a part of a request comment.
The Atlassian supported way to add an attachment as a customer user to a request is to use this rest endpoint: https://docs.atlassian.com/jira-servicedesk/REST/4.13.1/#servicedeskapi/request/{issueIdOrKey}/attachment-createAttachment . This endpoint uses temporary files created by endpoint https://docs.atlassian.com/jira-servicedesk/REST/4.13.1/#servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile . And the attachTemporaryFile endpoint does not support Base64 encoded attachments.
We can provide an alternative implementation of attachTemporaryFile in our plugin that will support Base64 attachments. This implementation will return temporary attachment ids that can be then used in a call to https://docs.atlassian.com/jira-servicedesk/REST/4.13.1/#servicedeskapi/request/{issueIdOrKey}/attachment-createAttachment . Would that be sufficient for you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That would be awesome and i think your addon will get more attractions to those who integrating service desk with third party like BMC Remedy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Muhammad Ramzan_Atlassian Certified Master_ Thank you for confirmation, we will soon release a version of our plugin that will support creating temporary attachment / file ids.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.