Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

jira add attachment api returns empty array with status code 200 Edited



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.




1 answer


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