Jira Attachments

iHub Cloud: Sending Jira Attachments to External APIs

iHub Cloud allows you to securely transfer attachments from Jira issues to another API using a process called form-data. This functionality is accessible through a radio button selection next to the "body" field.

Choosing Attachments to Send:

  • All Attachments ({{attachments.all}}): This option instructs iHub Cloud to include any and all attachments currently associated with the Jira issue in the outbound data transfer.

  • Unsent Attachments Only ({{attachments.unsent}}): This option is designed for scenarios where you only want to send attachments that haven't been previously transferred. This ensures efficient data transmission by avoiding redundant deliveries.

Handling Failed Transfers:

If the data transfer to the external API fails (indicated by a status code outside the 2xx range, such as 404 or 500), iHub Cloud will not mark the attachments as sent. This means that any subsequent retries will include these unsent attachments. This behavior prevents successful attachments from being unnecessarily resent during retries.

Key Improvements:

Building Form-Data for External APIs

iHub Cloud uses a JSON structure to define the data you want to send to an external API. This structure is then converted into a format called "form-data" which is compatible with many APIs.

Adding Custom Fields:

You can easily add additional data points to your form-data by specifying them as JSON properties with corresponding values. Here's an example:

{ "file": "{{attachments.all}}", "summary": "{{issue.fields.summary}}", "fixedValue": "Hello World" }

Special Mustache Variables:

iHub Cloud provides special variables called Mustache variables, denoted by double curly braces {{ }}. These variables streamline the process of including Jira attachments in your form-data:

  • {{attachments.all}}: This variable automatically includes all attachments associated with the current Jira issue.

  • {{attachments.unsent}}: This variable specifically includes only attachments that haven't been sent previously.

These variables eliminate the need for complex loops or expressions to handle attachment packaging.

Customizing Field Names:

In the example above, the property file is used as the key within the form-data to store attachments. However, different APIs might use different names for this field. You have the flexibility to choose any name that suits your needs. For instance, Freshdesk uses the name attachments for the same purpose.

 

https://rixter.atlassian.net/wiki/spaces/RIFJ/pages/1529839659

https://rixter.atlassian.net/wiki/spaces/RIFJ/pages/1529217130