Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

jira add attachment api returns empty array with status code 200




I am using wso2 ESB for Integrating one of my internal application with my JIRA instance

There is a feature - adding attachments to an issue in Jira. My internal application would send the filename and value(bytearray) in a json format. I will take that json, send it from my wso2 ESB to Jira to add the attachment.  when i am passing the bytearray and filename, it returns 200 status code but with empty array. Please find the below code. Can anyone has come across this kind of issue and help me. Thank you. 


<resource methods="POST" uri-template="/addAttachments/issues?issueKey={value}">
<log level="custom">
<property name="message" value=">>>> Inside addAttachments API"/>
<property expression="get-property('query.param.issueKey')" name="uri.var.issueKey" scope="default" type="STRING"/>
<property expression="wso2:vault-lookup('Jira.Username')" name="Jira.Username" scope="default" type="STRING"/>
<property expression="wso2:vault-lookup('Jira.Password')" name="Jira.Password" scope="default" type="STRING"/>
<property expression="fn:concat(get-property('Jira.Username'),':',get-property('Jira.Password'))" name="JiraCredentials" scope="default" type="STRING"/>
<property expression="fn:concat('Basic ', base64Encode(get-property('JiraCredentials')))" name="Authorization" scope="transport" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<header name="X-Atlassian-Token" scope="transport" value="nocheck"/>
<log level="custom">
<property expression="json-eval($)" name="inputpayloadFromPostman"/>
<payloadFactory media-type="xml">
<arg evaluator="xml" expression="//value"/>
<arg evaluator="xml" expression="//filename"/>
<log level="custom">
<property expression="json-eval($)" name="payloadfactory"/>
<property name="messageType" scope="axis2" type="STRING" value="multipart/form-data"/>
<property name="boundary" scope="default" type="STRING" value="----1234456----"/>
<header expression="fn:concat('multipart/form-data; boundary=',get-property('boundary'))" name="Content-Type" scope="transport"/>
<http method="post" uri-template="{uri.var.issueKey}/attachments">
<property expression="$axis2:HTTP_SC" name="HTTP_SC" scope="axis2" type="STRING"/>



I have tried using Jira connector also, i t gives the same response.




2 answers


You should set file's key = "file"

KEY           VALUE

file             testattach.txt



I am also getting the same error, I have changed file key even than the error is same can anyone help?

Suggest an answer

Log in or Sign up to answer

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you