Hello,
Will appreciate some assistance here please...
We have been able to use the below JSON file to open up an issue in JIRA.
However, we want to take this a step further... We will like to add an attachment to this issue, either via:
1. When issue is originally opened usig below JSON file.
OR
2. Use the issue number created from below file, to add an attachment to issue.
{
"fields": {
"issuetype":
{ "name": "Letter of Greeting" }
,
"project":
{ "key": "CCOPS" }
,
"customfield_10063": "City/Town",
"customfield_10101": "Charitable Organization Number",
"customfield_10069":
{ "value": "Pending" }
,
"customfield_10070":
{ "value": "Pending" }
,
"customfield_10102": "URL",
"labels": [ "greeting" ],
"customfield_10103": [
{ "value": "By clicking this button I confirm that I am the Official Representative of the Organization requesting the Proclamation" }
],
"customfield_10016": "Organization Name",
"customfield_10017": "Event Name",
"customfield_10018": "2016-11-28",
"customfield_10019":
{ "value": "Convention" }
,
"assignee":
{ "name": "mhelly", "key": "mhelly" }
,
"description": "Description",
"customfield_10011": "Province",
"customfield_10012": "Postal Code",
"customfield_10014": "Additional Notes",
"customfield_10015": "2016-11-27",
"customfield_10005": "Telephone Number",
"summary": "Please enter a summary for this Service Request.",
"customfield_10081": "Street Number",
"customfield_10082": "Street Name",
"customfield_10083": "Unit Number",
"customfield_10084": "First Name",
"customfield_10085": "Last Name",
"customfield_10086": "Email@Email.Email",
"reporter":
{ "name": "CCO_Webmaster", "key": "CCO_Webmaster" }
}
}
Hello Mohammed,
Please check POST /rest/api/2/issue/{issueIdOrKey}/attachments.
Hi Volodymyr,
I looked to curl command but
my point is to use JQUERY to get this job done.
Here is my code:
var formdata = new FormData();
formdata.append('tasks', "C:\01-Rosana-Protocol\NOV-2016\Tasks10.txt");
formdata.append('tabs', "C:\01-Rosana-Protocol\NOV-2016\chroom tabs10.txt");
_.forEach(formdata.entries(), function (value, key) {
console.log(key);
});
for (var k in formdata.entries()){
console.log(k[0]+ ', ' + k[1])
}
$.support.cors = true;
$.ajax({
type: "POST",
url: "http://Mvclkpro01d.corp.toronto.ca:8080/rest/api/2/issue/CCOPS-50/attachments",
data: formdata,
contentType: false,
processData: false,
headers: {
"X-Atlassian-Token": "nocheck"
},
// contentType: "multipart/form-data; boundary=HereGoes",
contentType: "multipart/form-data",
success: function (data, status, req) {
alert("Data Loaded : " + data);
},
error: function (jqXHR, textStatus, errorThrown) {
alert('responseText ' + jqXHR.responseText);
alert('error in uploading:: ' + errorThrown);
}
});//Ajax
});//click
After executing this AJAX call I got nothing uploaded into JIRA isssue
Thanks for your help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I never did multipart file upload via jQuery and I guess it's restricted by due to security reasons. Please debug your request to check if files are actually send.
Please consider doing this via html form.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.