---
title: "Send attachments with REST calls"
canonical: "https://support.appfire.com/space/EI4J/11206667/Send%20attachments%20with%20REST%20calls"
format: markdown
---
> Macro (aura-html)

This guide explains how to send attachments along with your REST calls for Jira, Jira Service Management, and ServiceNow.

![Screenshot 2024-08-14 at 15.06.44.png](media://77fd9311-aebc-4d63-8e32-980650c0e8fc)

1. <span style="color: #000000">First, tick the </span><span style="color: #000000">**Send Attachments **</span><span style="color: #000000">box.</span>
2. <span style="color: #000000">If you would like to send attachments one by one, tick the "Send one by one" option.</span>
3. <span style="color: #000000">Write the name of the form-data parameter name that contains attachments. For instance, in Jira REST API for attachments, this name must be </span>`file`<span style="color: #000000">, and in ServiceNow REST API, this name must be </span>`uploadFile`<span style="color: #000000">.</span>
4. <span style="color: #000000">Write a groovy script that returns attachments. These attachments will be sent with the REST Call. If the script is empty, then all attachments will be sent.</span>

**Attachment Script**

```groovy
import com.atlassian.jira.component.ComponentAccessor;

import com.atlassian.jira.issue.AttachmentManager;

AttachmentManager attachmentManager = ComponentAccessor.getAttachmentManager();

def attachments = attachmentManager.getAttachments(issue);

return attachments;
```

## Using with Jira

1. <span style="color: #000000">Write the Jira API URL as</span><span style="color: #000000">** **</span>`{Base_Url}/api/2/issue/{issueIdOrKey}/attachments`.
2. <span style="color: #000000">Select POST as the method.</span>
3. <span style="color: #000000">Jira API requires a special header for this operation. You need to add this header to the header section.</span>
4. <span style="color: #000000">Choose a credential that has permission for the operation.</span>
5. <span style="color: #000000">Lastly, type </span>`file`<span style="color: #000000"> into the parameter name for attachments.</span>

> 📝 <span style="color: #000000">For more information, head to</span> the [Atlassian documentation](https://docs.atlassian.com/software/jira/docs/api/REST/8.3.0/#api/2/issue/{issueIdOrKey}/attachments).

## Using with Jira Service Management

1. <span style="color: #000000">Write the Jira Service Management API URL as: </span>`{Base_Url}/rest/servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile`.
2. <span style="color: #000000">Select POST as the method.</span>
3. <span style="color: #000000">Jira Service Management API requires a special header for this operation. You need to add this header into the header section:</span>
4. <span style="color: #000000">Choose a credential that has permission for the operation.</span>
5. <span style="color: #000000">Lastly, write </span>`file`<span style="color: #000000"> into parameter name for attachments.</span>

> 📝 For more information, refer to the [Atlassian documentation](https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/#servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile).

## Using with ServiceNow

1. Write ServiceNow API URL as `{Base_Url}/api/now/attachment/upload`.
2. Select POST as the method.
3. ServiceNow API requires mandatory values with the request. You can write these values into the Request Body as key/value pairs. You can write your own `table_name` and `table_sys_id` values.
4. <span style="color: #000000">Choose a credential that has permission for the operation.</span>
5. <span style="color: #000000">Lastly, write </span>`uploadFile`<span style="color: #000000"> into the parameter name for attachments.</span>

> 📝 ServiceNow API allows only one attachment per request. If you need to send more than one attachment, select the **Send one by one** option.
> 📝 
> 📝 <span style="color: #000000">For more information, refer to the </span><span style="color: #000000">[ServiceNow documentation](https://developer.servicenow.com/dev.do#!/reference/api/paris/rest/c_AttachmentAPI#attachment-POST-upload)</span><span style="color: #000000">.</span>