attachTemporaryFile method
- required String serviceDeskId,
- required MultipartFile file,
This method adds one or more temporary attachments to a service desk, which can then be permanently attached to a customer request using servicedeskapi/request/{issueIdOrKey}/attachment.
Note: It is possible for a service desk administrator to turn off the ability to add attachments to a service desk.
This method expects a multipart request. 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 MultiPartEntity.
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 or it will be blocked.
The name of the multipart/form-data parameter that contains the
attachments must be file
.
For example, to upload a file called myfile.txt
in the Service Desk with
ID 10001 use
curl -D- -u customer:customer -X POST -H "X-ExperimentalApi: opt-in"
-H "X-Atlassian-Token: no-check" -F "file=@myfile.txt" https://your-domain.atlassian.net/rest/servicedeskapi/servicedesk/10001/attachTemporaryFile
Permissions required: Permission to add attachments in this Service Desk.
Implementation
Future<TemporaryAttachments> attachTemporaryFile(
{required String serviceDeskId, required MultipartFile file}) async {
return TemporaryAttachments.fromJson(await _client.send(
'post',
'rest/servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile',
pathParameters: {
'serviceDeskId': serviceDeskId,
},
file: file,
));
}