This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Attachments in JIRA

The following operation is available when working with attachments. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with attachments, see Sample configuration .

OperationDescription
getAttachmentByIdRetrieves the meta-data for an attachment, including the URL of the actual attached file.

getAttachmentContent

Returns the content of an attachment.

Following is more information about these operations.

Retrieving the meta-data for an attachment

This operation retrieves the meta-data for an attachment, including the URL of the actual attached file.

getAttachmentById
<jira.getAttachmentById>
	<attachmentId>{$ctx:attachmentId}</attachmentId>
</jira.getAttachmentById>
Properties
  • attachmentId: The ID to view the meta data of the attachment.
Sample request

Following is a sample REST/JSON request that can be handled by the getAttachmentById operation.

Sample request for getAttachmentById
{
  "uri": "https://testappmahesh.atlassian.net",
  "username": "admin",
  "password": "1qaz2wsx@",
  "attachmentId": "10000"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e168

Retrieving the content for an attachment

This operation retrieves the content of an attachment.

getAttachmentContent
<jira.getAttachmentContent>
	<attachmentUrl>{$ctx:attachmentUrl}</attachmentUrl>
	<fileType>{$ctx:fileType}</fileType>
</jira.getAttachmentContent>
Properties
  • attachmentUrl: The URI of the attached file.
  • fileType: Type of the attachment.
Sample request

Following is a sample REST/JSON request that can be handled by the getAttachmentContent operation.

Sample request for getAttachmentContent
{
  "uri": "https://testappmahesh.atlassian.net",
  "username": "admin",
  "password": "1qaz2wsx@",
  "attachmentUrl": "https://qspdemo.atlassian.net/secure/attachment/10373/5a459cc4473f5a24df464f7f270f2c13.jpg",
  "fileType":"image/jpeg"
}

Sample Configuration

Following is a sample proxy service that illustrates how to connect to Jira with the init operation and use the getAttachmentById operation. The sample request for this proxy can be found in getAttachmentById sample request.You can use this sample as a template for using other operations in this category.

Sample proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="jira_getAttachmentById" transports="https" statistics="disable"
   trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="uri" expression="json-eval($.uri)" />
         <property name="username" expression="json-eval($.username)" />
         <property name="password" expression="json-eval($.password)" />
         <property name="attachmentId" expression="json-eval($.attachmentId)" />
         <jira.init>
            <uri>{$ctx:uri}</uri>
            <username>{$ctx:username}</username>
            <password>{$ctx:password}</password>
         </jira.init>
         <jira.getAttachmentById>
            <attachmentId>{$ctx:attachmentId}</attachmentId>
         </jira.getAttachmentById>
         <respond />
      </inSequence>
      <outSequence>
         <send />
      </outSequence>
   </target>
   <description />
</proxy>  

Â