Skip to content

Function: attachTemporaryFile() ​

ts
function attachTemporaryFile(
   client, 
   parameters, 
   options?
): Promise<{
[key: string]: unknown;
  temporaryAttachments?: object[];
}>;

Defined in: src/serviceDeskServer/api/requestAttachments.ts:63

Create one or more temporary attachments, which can later be converted into permanent attachments on Create attachment.

On successful execution, this resource will return a list of temporary attachment IDs, which are used in subsequent calls to convert the attachments into permanent attachments.

This resource expects a multipart post. The media-type multipart/form-data is defined in RFC 1867. Most client libraries have classes that make dealing with multipart posts simple. For instance, in Java the Apache HTTP Components library provides a MultiPartEntity that makes it simple to submit a multipart POST.

In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: no-check with the request, otherwise it will be blocked.

The name of the multipart/form-data parameter that contains attachments must be "file".

A simple example to upload a file called "myfile.txt" in service project with ID 10001

curl -D- -u customer:customer -X POST -H "X-Atlassian-Token: no-check" -F.

Parameters ​

ParameterTypeDescription
clientClient-
parameters{ body: | AttachmentInput | AttachmentInput[]; serviceDeskId: string; }-
parameters.body| AttachmentInput | AttachmentInput[]-
parameters.serviceDeskId?stringThe ID of the service desk.
options?RequestOptions-

Returns ​

Promise<{ [key: string]: unknown; temporaryAttachments?: object[]; }>