You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
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 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.
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 , 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 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.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.