Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Add attachment using API JIRA


I am trying to add attachment by using the two API POST /rest/servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile and servicedeskapi/request/{issueIdOrKey}/attachment

I use a popup to upload the attachement and this is How i retrieve it

let file =document.getElementById(idElement);
let formData = new FormData();
formData.append('file', file.files[0]);

and then i pass it to this function:

function addAttachment(keyOrId, comment, formData) {
const requestData = {
"temporaryAttachmentIds": [],
"public": true,
"additionalComment": {
"body": comment

url: restUrl,
type: "POST",
processData: false,
contentType: "multipart/form-data",
headers: {
"X-Atlassian-Token": "no-check",
"X-ExperimentalApi": "opt-in"
data: file,
success: function(response) {
// The file was uploaded successfully, so attach it to the issue
const attachmentId = response.temporaryAttachmentId;

url: attachurl,
type: "POST",
contentType: 'application/json; charset=UTF-8',
headers: {
"X-Atlassian-Token": "no-check",
"X-ExperimentalApi": "opt-in"
data: JSON.stringify(requestData),
success: function(response) {
// The file was attached to the issue successfully
console.log("File attached to issue successfully");
error: function(jqXHR, textStatus, errorThrown) {
console.error(`Error attaching file to issue: ${errorThrown}`);
error: function(jqXHR, textStatus, errorThrown) {
console.error(`Error uploading file: ${errorThrown}`);


but it does not work and does not show any errorr. Anyone could tell me what I am doing wrong?

0 answers

Suggest an answer

Log in or Sign up to answer